DELPHI把一个字符串中的某个子串,用另一个子串去替换


本文整理自网络,侵删。

 
function StrReplace(s,oldstr,newstr:string):string; //字符串替换
var
SelPos,SelLen: Integer;
begin
SelPos := Pos(oldstr, s);
while SelPos > 0 do
begin
SelLen := Length(oldstr);
delete(s,SelPos,SelLen);
insert(newstr,s,SelPos);
SelPos := Pos(oldstr, s);
end;
Result:=s;
end;

相关阅读 >>

Delphi_关于null,nil

Delphi 如何获得其他进程的token

Delphi获取jpg图片的高度、宽度

Delphi不占cpu的延时函数

Delphi 使用indy解决tidssliohandlersocketopenssl could not load ssl library错误

Delphi unicode转中文编码

Delphi 禁止截屏printscreen

Delphi memo 自动滚动到最底下

Delphi程序与chm帮助关联的简单实现

Delphi xe2创建apple ios程序

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...