痞客幫沒貼原始碼功能=.=?
{-------------------------------------------------------------------------------
程序名稱: SplitString 切割文字
作 者: Administrator
日 期: 2007.12.03
傳 入 值: const Source,ch:string
返 回 值: TStringList
-------------------------------------------------------------------------------}
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;
使用範例
tstring := SplitString('192.168.1.1','.');
Result:=tstring[0]+'.'+ tstring[1]+'.'+tstring[2]+'.*';
留言列表