怎样可以取到字符串中的后几位字符,有什么函数没有?字符的位数是不确定的,不管有多长只取后面几后,该怎样去做?

解决方案 »

  1.   

    RightStr(const AText: AnsiString; const ACount: Integer)DescriptionRightStr returns the trailing characters of AText up to a length of ACount characters. Thus, for example, if AText is the string "Programmer" and ACount is 7, RightStr returns the string "grammer".Note: If AText is an AnsiString and the current locale uses multi-byte characters, RightStr may return more than ACount bytes. To return a specific number of bytes, use RightBStr.
      

  2.   

    令n=length(s);s是你未知长度的字符串,
    i:=n-j;
    i是截取起点,j是截取字符串长度,
    你需要的字符串s1:=copy(s,i,j);