本文整理自网络,侵删。
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);beginCaption:=SplitString('123==456==789','==').Strings[1];end;
相关阅读 >>
Delphi 几个dataset数据导出到xml word excel txt html的函数
Delphi判断mssql数据库中表格是否存在? 如何批量创建表格?
Delphi thread.queue与synchronize的区别
Delphi winapi: getparent - 获取指定窗口的父窗口句柄
更多相关阅读请进入《Delphi》频道 >>