Dephi 中优秀的字符串分割函数
发表于:2007-06-11来源:作者:点击数:
标签:
DELPHI没有自己的字符串分割函数,所以只能 程序员 自己写了,网上搜了好多但是真正好用的没有几个, 下面这个是我在网上找到修改后了的,个人感觉算法不错,所以就贴了上来。 functionSplitString(Source,Deli:string):TStringList;s td call; var EndOfCurr
DELPHI没有自己的字符串分割函数,所以只能
程序员自己写了,网上搜了好多但是真正好用的没有几个,
下面这个是我在网上找到修改后了的,个人感觉算法不错,所以就贴了上来。
function SplitString(Source, Deli: string ): TStringList;s
tdcall;
var
EndOfCurrentString: byte;
StringList:TStringList;
begin
StringList:=TStringList.Create;
while Pos(Deli, Source)>0 do
begin
EndOfCurrentString := Pos(Deli, Source);
StringList.add(Copy(Source, 1, EndOfCurrentString - 1));
Source := Copy(Source, EndOfCurrentString + length(Deli), length(Source) - EndOfCurrentString);
end;
Result := StringList;
StringList.Add(source);
end;
本文引用通告地址: http://blog.csdn.net/mahuzi/services/trackbacks/502563.aspx