您的位置:首页 > 编程语言 > Delphi

DELPHI字符串分割函数

2006-02-02 01:55 399 查看
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;

procedure StrToStrs(str:string;strs:tstrings);
var temp:string;
i:integer;
label B,E;
begin
B:
i:= ansipos('|',str);
if i=0 THEN GOTO E;
strs.Add(ansileftstr(str,i-1));
str:=ansirightstr(str,length(str)-i);
GOTO B;
E:
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: