首页 > 代码库 > delphi将字符串转换成stringlist

delphi将字符串转换成stringlist

function StrToList(const sString, Token: string): TStringList;
var
sTmp: string;
iPos: Integer;
Toklen: Integer;
begin
Toklen := Length(Token);
Result := TStringList.Create;
sTmp := sString;
iPos := Pos(Token, sTmp);
while iPos <> 0 do
begin
Result.Add(Copy(sTmp, 1, iPos - 1));
Delete(sTmp, 1, iPos - 1 + Toklen);
iPos := Pos(Token, sTmp);
end;
Result.Add(sTmp);
end;

delphi将字符串转换成stringlist