function SplitString(const Source,ch:String):TStringList;
var
Temp:String;
I:Integer;
chLength:Integer;
begin
Result:=TStringList.Create;
//如果是空自符串则返回空列表
if Source='' then Exit;
Temp:=Source;
I:=Pos(ch,Source);
chLength := Length(ch);
while I<>0 do
begin
Result.Add(Copy(Temp,0,I-chLength+1));
Delete(Temp,1,I-1 + chLength);
I:=pos(ch,Temp);
end;
Result.add(Temp);
end;
delphi split函数(积累)
最新推荐文章于 2024-08-07 19:10:01 发布
本文介绍了一个用于将字符串按指定字符拆分成列表的函数SplitString。该函数能够处理包含重复分隔符的情况,并确保所有子字符串都被正确地提取出来。
384

被折叠的 条评论
为什么被折叠?



