本文整理自网络,侵删。
aaaa 0.1bbbbb 1.23asdfadf 1254=====================想把上面的字符串变成之间只有一个空格:aaaa 0.1bbbbb 1.23asdfadf 1254
//删除字符串重复的符号function StrPosCount(subs:string;source:string):integer;varStr : string;beginResult := 0;str := source;while Pos(Subs,Str)<>0 dobeginDelete(Str,Pos(Subs,Str),Length(Subs));Inc(Result);end;
end;
function StrPosCount2(subs:string;source:string):string;varStr : string;beginResult :='';str := source;while Pos(Subs,Str)<>0 dobeginif StrPosCount(Subs,Str)=1 then break; //关键的地方在这里Delete(Str,Pos(Subs,Str),Length(Subs));Result:=Str;end;end;
调用方法:StrPosCount2('=',str1);
相关阅读 >>
Delphi使用tclientdataset时不携带midas.dll的方法
如何用Delphi实现windows xp中“本地连接”的启用和禁用
Delphi tms web core直接从html&css设计的页面布局
Delphi winapi: movewindow - 改变窗口的位置与大小
更多相关阅读请进入《Delphi》频道 >>