发信人: kingron(金龍)
整理人: kingron(2000-12-13 21:13:07), 站内信件
|
注意,你必须自己free!
function SplitString(const source,ch:string):tstringlist;
var
temp:string;
i:integer;
begin
result:=tstringlist.Create;
temp:=source;
i:=pos(ch,source);
while i<>0 do
begin
result.Add(copy(temp,0,i-1));
delete(temp,1,i);
i:=pos(ch,temp);
end;
result.Add(temp);
end;
调用:
s:=splitstring('afsdfsdaaa|bbfdsfsdb|ccc','|');
for i:=0 to s.Count-1 do
b:=b+s.Strings[i]+#13;
showmessage(b);
s.free;
---- ██████
█┏━━┓█
█┃之金┃█ 去Delphi版看看
█┃印龍┃█
█┗━━┛█
██████ |
|