function SplitString(const source,ch:string):tstrings;
//source字符串;ch字符串分割字符;返回值Tstrings相当于字符数组
var
 temp:string;
 i:integer;
begin
 result:=Tstringlist.Create;
 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;

解决方案 »

  1.   

    function StrLeft(const mStr: string; mDelimiter: string): string;
    begin
      Result := Copy(mStr, 1, Pos(mDelimiter, mStr) - 1);
    end; { StrLeft }function StrRight(const mStr: string; mDelimiter: string): string;
    begin
      if Pos(mDelimiter, mStr) <= 0 then
        Result := ''
      else Result := Copy(mStr, Pos(mDelimiter, mStr) + Length(mDelimiter), MaxInt);
    end; { StrRight }//....
    var
      S: string;
      S1, S2: string;
    begin
      S := '11111111111@eeeeeeeeeeeee';
      S1 := StrLeft(S, '@');
      S2 := StrRight(S, '@');
    end;
      

  2.   

    str1:=copy(Edit.Text,1,Pos(Edit.Text,'@'))
    Str2:=Copy(Edit.Text,Pos(Edit.Text,'@')+1,Length(Edit.Text)-Pos(Edit.Text,'@'))
      

  3.   

    我附加问一个问题COPY函数的用法,上面各位的使用COPY的时候,都传递了三个参量进去。我查看了一个HELP,只有两个啊,到底是一种什么样的格式?function Copy(S; Index, Count: Integer): string;Copy(mStr, Pos(mDelimiter, mStr) + Length(mDelimiter), MaxInt) ??
      

  4.   

    function Copy(S; Index, Count: Integer): string;
    //            ~  S, Index, Count !3个
    //S: 字符串或者数组;
      

  5.   

    zswang(伴水)(* 嘻 *) Copy(mStr, Pos(mDelimiter, mStr) + Length(mDelimiter), MaxInt) mstr 是 string
    Pos(mDelimiter, mStr) + Length(mDelimiter) 是 count
    那Maxint是什么??
      

  6.   

    Pos(mDelimiter, mStr) + Length(mDelimiter) 启始的字符串Maxint 是结束的字符串吗?