tempstr:='A*1*2*7*9*11';
i:=0;
while pos('*',tempstr)>0 do
begin
  list[i]:=copy(tempstr,1,pos('*',tempstr)-1);
  tempstr:=copy(tempstr,pos('*',tempstr)+1,length(tempstr));
  inc(i);
end;

解决方案 »

  1.   

    procedure StrToStrings(S: AnsiString; Sep: AnsiString; const List: TStrings);
    var
      I, L: Integer;
      Left: AnsiString;
    begin
      Assert(List <> nil);
      List.Clear;
      L := Length(Sep);
      I := Pos(Sep, S);
      while (I > 0) do
      begin
        Left := StrLeft(S, I - 1);
        List.Add(Left);
        Delete(S, 1, I + L - 1);
        I := Pos(Sep, S);
      end;
      if S <> '' then
        List.Add(S);
    end;
      

  2.   

    VB中有个函数split,可以实现这个功能,delphi中没有吗?
      

  3.   

    Delphi不是写了函数给你吗?难道Borland有义务将VB中的函数都写一遍吗?
      

  4.   


    同意 chechy(chechy) !!StrToStrings(S: AnsiString; Sep: AnsiString; const List: TStrings);
    调用就行了的。
      

  5.   

    这是JEDI函数库中的函数。
    var
      a: TStrings;begin
    a := TStringList.Create;
    StrToString('A*1*2*7*9*11', '*', a);
    然后a里面就是A, 1, 2, 7, 9, 11另补:
    function StrLeft(const S: AnsiString; Count: Integer): AnsiString;
    begin
      Result := Copy(S, 1, Count);
    end;
      

  6.   

    加分!就不知道JEDI函数库在哪里?