//根据字符串,拆分字符串,相当于vb中的split函数
function SplitString(const Source,ch:string):TStringList;
var
temp:String;
i:Integer;
begin
Result:=TStringList.Create;
//如果是空自符串则返回空列表
if Source=''
then exit;
temp:=Source;
i:=pos(ch,Source);
while i<>0 do
begin
Result.add(copy(temp,0,i-1));
Delete(temp,1,i);
i:=pos(ch,temp);
end;
Result.add(temp);
end;
delphi中的split函数
最新推荐文章于 2026-01-19 11:36:40 发布
博客展示了在Delphi中实现类似VB里split函数的代码。该函数可根据指定字符拆分字符串,若输入为空字符串则返回空列表,通过循环和字符串操作完成拆分,并将结果存储在TStringList中。
1537

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



