打印本文 打印本文 关闭窗口 关闭窗口
delphi中的split函数
作者:武汉SEO闵涛  文章来源:敏韬网  点击数794  更新时间:2009/4/23 18:35:01  文章录入:mintao  责任编辑:mintao

//根据字符串,拆分字符串,相当于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;

www.sinoprise.com

打印本文 打印本文 关闭窗口 关闭窗口