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;

posted @ 2017-07-25 13:49  坤霸天下  阅读(1907)  评论(0编辑  收藏  举报