SplitString分隔函数

samool 发布暂无评论11809 阅读

AI摘要

SplitString函数用于将字符串Source按照分隔符Deli进行分割,返回一个TStringList类型的列表。函数首先创建一个TStringList对象,然后循环查找分隔符,将分割后的字符串添加到列表中。最后,将剩余的字符串添加到列表并返回。

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;

  1. 01Golang 汇编入门知识总结2020-09-27
  2. 02mysql笔记(5)--集合函数,时间日期函数,字符串匹配函数2012-03-01
  3. 03SQL自定义函数实现特殊功能2011-09-07
  4. 04Delphi常用的函数库2008-03-11
  5. 05汇编级超快字符串替换函数2007-10-23
  6. 06IsNumeric 判断字符串是否为数字2007-10-22
  7. 07WinExecAndWait32调用外部程序,等待外部程序运行完成2007-10-22
  8. 08Delphi集成Windows验证登录函数2007-10-17
  9. 09Delphi函数返回多个值2007-10-11
  10. 10ASP数据库操作常用函数集2007-09-21
COMMENTS / 一纸留言

读者留言 0 条

一纸留言,便是山水间的一次相逢。

还没有留言,欢迎写下第一段交流。

WRITE A COMMENT

写下你的留言