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 2010 域名转换ip

Delphi 关于注释

Delphi 用正则表达式检查一个串是否是电信的手机号

Delphi idhttpserver实现webservice

Delphi 获取网络图片在webbrowser显示 android/osx/ios/win的最佳方式

Delphi xe 泛型数组和splitstring处理数据

Delphi 用拼音首字符检索汉字的源代码

Delphi 设置webbrowser 代理服务器 与 useragent

Delphi 获取窗体坐标触发事件

Delphi & c++ 安卓使用权限

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



打赏

取消

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

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

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

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

评论

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

    正在狠努力加载,请稍候...