s:=copy(s,2,3);(字符串,从第几位开始,取几位)

解决方案 »

  1.   

    function Copy(S; Index, Count: Integer): string;
    function Copy(S; Index, Count: Integer): array;DescriptionS is an expression of a string or dynamic-array type. Index and Count are integer-type expressions. Copy returns a substring or sub array containing Count characters or elements starting at S[Index]. If Index is larger than the length of S, Copy returns an empty string or array.If Count specifies more characters or array elements than are available, only the characters or elements from S[Index] to the end of S are returned.Note: When S is a dynamic array, Copy can only be used as a parameter in a call to a procedure or function that expects an array parameter. That is, it acts like the Slice function when working with dynamic arrays.
      

  2.   

    Copy(源字符串: string,起始位置: Integer,目标长度: Integer);
    Pos(子串:string,源字符串:string); //获得子串在源字符串的位置
      

  3.   

    function GetSubStr(S: String; Index: Integer): String;
    begin
      Result := Copy(S, Index, Length(S) - Index +1);
    end;function LeftStr(S: String; Len: Integer): String;
    begin
      Result := Copy(S, 1, Len);
    end;function RightStr(S: String; Len: Integer): String;
    begin
      Result := Copy(S, Length(S) - Len +1, Len);
    end;