类似于Split(VB)的函数

procedure ParseStrToStrings(AStrings:TStrings;S:String;iType:integer;seperator:string);

var

i:integer;

begin

if (iType<0) or (iType>5) then

Exit;

if iType=4 then

begin

AStrings.CommaText :=s;

Exit;

end;

case iType of

0: Seperator :=',';

1: Seperator :=';';

2: Seperator :=' ';

3: Seperator :=chr(VK_TAB);

end;

i:=pos(seperator,s);

while i>0 then

begin

AStrings.Add(Copy(s,0,i-1));

s :=copy(s,i+length(seperator),length(s));

i :=pos(seperator,s);

end;

if s<>' ' then

AStrings.Add(s)

end;

原文地址:https://www.cnblogs.com/djcsch2001/p/2035834.html