Delphi SplitString 字符串分割成字符串组


本文整理自网络,侵删。

 
function SplitString(Source, Deli: string): TStringList;      //把字符串分割成字符串组
var
  EndOfCurrentString: byte;
  StringList: TStringList;
begin
  StringList := TStringList.Create;
  while Pos(Deli, Source) > 0 do
  begin
    EndOfCurrentString := Pos(Deli, Source);
    StringList.add(Copy(Source, 1, EndOfCurrentString - 1));
    Source := Copy(Source, EndOfCurrentString + length(Deli), length(Source) - EndOfCurrentString);
  end;
  Result := StringList;
  StringList.Add(Source);
end;

简单用法:
procedure TForm1.FormCreate(Sender: TObject);
begin
Caption:=SplitString('123==456==789','==').Strings[1];
end;

相关阅读 >>

Delphi 在win32程序中显示dos调试窗口

Delphi 简单的操作memo1剪切 复制 粘贴 撤销 全选 清空

Delphi使用spcomm没办法触发receivedata

Delphi 计算一个字符串在另一个字符串中出现的次数

Delphi xe2 将域名转ip

Delphi xe7写的一个http post的小测试程序

Delphi调用游戏call代码

Delphi字符串中取数字

Delphi messagebox 使用

Delphi 判断端口是否被使用

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...