在指定位置插入字符串 [英] Insert string at specified position
本文介绍了在指定位置插入字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可以做到这一点的PHP函数?
Is there a PHP function that can do that?
我正在使用strpos
获取子字符串的位置,我想在该位置之后插入string
.
I'm using strpos
to get the position of a substring and I want to insert a string
after that position.
推荐答案
$newstr = substr_replace($oldstr, $str_to_insert, $pos, 0);
这篇关于在指定位置插入字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文