function StringsToStr(const List: TStrings; Sep: AnsiString): AnsiString;
var
  I, L: Integer;
begin
  Result := '';
  for I := 0 to List.Count - 1 do
  begin
    // don't combine these into one addition, somehow it hurts performance
    Result := Result + List[I];
    Result := Result + Sep;
  end;
  // remove last separator, doing this afterwards saves an if in the loop
  if List.Count <> 0 then
  begin
    L := Length(Sep);
    Delete(Result, Length(Result) - L + 1, L);
  end;
end;function StrLeft(const S: AnsiString; Count: Integer): AnsiString;
begin
  Result := Copy(S, 1, Count);
end;

解决方案 »

  1.   

    str1 str2 str3 .....strn中不知你是字符数组,还是字符串.
    如果是字符数组的话,则可用chechy(chechy) 的方法.
    如果是字符串的话,不知,你的stri是否都不为空?否则很难判断.
      

  2.   

    对不起,看错函数了。应该是:
    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;
      

  3.   

    strleft()????编译不过呀????
    快快快
      

  4.   

    to chechy(chechy) 
    OK,给分了,谢了先,,,,相你学习哟
      

  5.   

    function TForm1.split(S:String):TStringList;
    var
      ST : TStringList;
      P : Integer;
    begin
      P := Pos( ' ', S );
      ST := TStringList.Create;
      while P > 0 do
      begin
        ST.Add( Copy( S, 1, P-1 ) );
        Delete( S, 1, P );
        P := Pos( ' ', S );
      end;
      Result := ST;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      ListBox1.Items := Split('aabb dfe eafdih effd gadg ee ');
    end;