比如一个字符串是 '1111测试' 怎样变成 '测试' ??

解决方案 »

  1.   

    以前是用别的语言写程序,Delphi用的时间不长,请指教!
      

  2.   

    '1111测试' 怎样变成 '测试' ??
    如果都是你这种格式 1111+你要的string
    可以自己写个函数
      

  3.   

    或者你用copy函数
    Returns a substring of a string or a segment of a dynamic array.UnitSystemCategorystring handling routinesfunction 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.
      

  4.   

    Delphi的字符串处理函数里面有没有类似于C++的Replace的函数呢?
      

  5.   

    StrUtils.pasfunction AnsiReplaceText(const AText, AFromText, AToText: string): string; 
      

  6.   

    s:='1111测试' 
    s:=StringReplace(s,'1111','',[rfReplaceAll, rfIgnoreCase]);
      

  7.   

    替换子串:Raplace()
    查找子串:Pos()
    删除子串:Delete()
      

  8.   

    s := '1111测试' 
    s := copy(s,pos('测',s),4);
      

  9.   

    pos()
    delete()
    copy()or StringReplace()detail see Help.
      

  10.   

    StringReplace('1111测试','1111','',[rfReplaceAll])