delphi中的split函数

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 newsunet 的 blog

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

本文关键:delphi中的split函数
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top