如:
s := '1;2;3;252;152;5511;2;0;252;'
现在我想循环得出用分号分开的每一字符怎么做呢?
如:
1
2
3
252
152
...

解决方案 »

  1.   

    给个函数
    Strings1:=SplitString(s,';');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;