当前位置:编程文档 >> DELPHI >> DELPHI字符串分割函数
首页

DELPHI字符串分割函数

所属类别:DELPHI
推荐指数:★★★★
文档人气:700
本周人气:2
发布日期:2006-8-29

DELPHI没有自己的字符串分割函数,所以只能程序员自己写了,网上搜了好多但是真正好用的没有几个, 
下面这个是我在网上找到修改后了的,个人感觉算法不错,所以就贴了上来。 


function SplitString(Source, Deli: string ): TStringList;stdcall; 
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;

文档说明:

     

相关文档


读取评论列表……