给你写出来吧 var s,tmps:string; i:integer; begin s:='aaaa;bbbb;ddddd;eeee'; tmps:=s; i:=pos(';',tmps); while i<>0 do begin showmessage(copy(tmps, 0, i - 1)); delete(tmps, 1, i); i := pos(';',tmps); end;
楼上 qxj(小小小小小小程序员) 已说了, 不要再说了吧
感谢qxj(小小小小小小程序员) 还有其他高招吗?
var strstemp:tstringlist; i:integer; begin strstemp:=tstringlist.Create ; strstemp.Delimiter :=':'; strstemp.DelimitedText:=s; for i:=0 to s.count-1 do showmessage(s[i]); strstemp.free end;
zjybestzjybest(zjybestzjybest)不错,还有吗
while length(s) > 0 do begin ss.add(copy(s,1,pos(':',s))); s := copy(s,pos(':',s),length(s)); end;
copy()得到所要的结果
var
s,tmps:string;
i:integer;
begin
s:='aaaa;bbbb;ddddd;eeee';
tmps:=s;
i:=pos(';',tmps);
while i<>0 do
begin
showmessage(copy(tmps, 0, i - 1));
delete(tmps, 1, i);
i := pos(';',tmps);
end;
qxj(小小小小小小程序员)
已说了, 不要再说了吧
还有其他高招吗?
strstemp:tstringlist;
i:integer;
begin
strstemp:=tstringlist.Create ;
strstemp.Delimiter :=':';
strstemp.DelimitedText:=s;
for i:=0 to s.count-1 do
showmessage(s[i]);
strstemp.free
end;
begin
ss.add(copy(s,1,pos(':',s)));
s := copy(s,pos(':',s),length(s));
end;
s := '1234:5678:1122:3354'