delphi 替换指定字符串的函数


本文整理自网络,侵删。

 一个替换指定串的函数,从一个字符串中找出指定子串,并替换为另一子串。
代码如下:
function replacing(S,source,target:string):string;
var site,StrLen:integer;
begin
{source在S中出现的位置}
site:=pos(source,s);
{source的长度}
StrLen:=length(source);
{删除source字符串}
delete(s,site,StrLen);
{插入target字符串到S中}
insert(target,s,site);
{返回新串}
replacing:=s;
end;

相关阅读 >>

Delphi 中有 iif() 函数

Delphi源码webbrowser多次执行documentcomplete

Delphi image 图像清空

Delphi xe实现android 添加图片资源到应用并使用它

Delphi 获取文件所在路径

Delphi 将strings合并成一个逗号分隔的字符串,用于sql

Delphi2009之timage

Delphi controlcount和componentcount的区别

Delphi 2009 之 tstringbuilder 类[4]: insert 与 remove

Delphi里面判断一个字符串在另一个字符串中出现的次数

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



打赏

取消

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

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

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

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

评论

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