比如又一段话,我现在象截取其中一部分。怎么做?

解决方案 »

  1.   

    function Copy(S; Index, Count: Integer): string;
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      you_say:widestring;
    begin
      you_say:='我是中国人';
      showmessage(copy(you_say,3,3));
    end;
      

  3.   

    dulei115() +
    S: 要截的字符串;
    Index: 截取开始位置;
    Count: 截取的长度;
    OK
      

  4.   

    如: i love i love you i i.提取第二个i和第三i之间的字符串
      

  5.   

    var
      s: string;
      index, count: integer;
    begin
      s := 'i love i love you i i';
      index := pos('i', s) + 1;
      index := posex('i', s, index) + 1;
      count := posex('i', s, index) - index;
      showmessage(copy(s, index, count));
    end;
      

  6.   

    请问楼上:posex()是在哪个单元里面的??
      

  7.   

    在StrUtils单元中,这种问题只要在Help中找到所需要的函数,Help中就说明了在那个单元。
      

  8.   

    function LeftStr(const AText: AnsiString; const ACount: Integer): AnsiString; overload;
    function LeftStr(const AText: WideString; const ACount: Integer): WideString; overload;
      

  9.   

    function RightStr(const AText: AnsiString; const ACount: Integer): AnsiString; overload;
    function RightStr(const AText: WideString; const ACount: Integer): WideString; overload;
      

  10.   

    Returns the index value of a substring.UnitStrUtilsCategorystring handling routinesDelphi syntax:function PosEx(const SubStr, S: string; Offset: Cardinal = 1): Integer;C++ syntax:extern PACKAGE int __fastcall PosEx(const AnsiString SubStr, const AnsiString S, unsigned Offset = 1);DescriptionPosEx returns the index of SubStr in S, beginning the search at Offset. If Offset is 1 (default), PosEx is equivalent to Pos.PosEx returns 0 if SubStr is not found, if Offset is greater than the length of S, or if Offset is less than 1.
      

  11.   

    请教dulei115() posex为何意?重定义也不行呀
      

  12.   

    你用的版本是几,在5中没有SysUtils