字符串的处理,往往是很多地方都要用到的。对于一个字符串,可以用以下方法来完成。 type userarray=array of string; function tform1.split(s:string;dot:char):userarray; 你可以改造一下,让它来达到你需要的结果。
var
str:userarray;
i,j:integer;
begin
i:=1;
j:=0;
SetLength(str, 255);
while Pos(dot, s) > 0 do
begin
str[j]:=copy(s,i,pos(dot,s)-i);
i:=pos(dot,s)+1;
s[i-1] := chr(ord(dot)+1);
j:=j+1;
end;
str[j]:=copy(s,i,strlen(pchar(s))-i+1);
result:=str;
end;
