CString SpanExcluding( LPCTSTR lpszCharSet ) const;
throw( CMemoryException );Return Value
A substring that contains characters in the string that are not in lpszCharSet, beginning with the first character in the string and ending with the first character found in the string that is also in lpszCharSet (that is, starting with the first character in the string and up to but excluding the first character in the string that is found lpszCharSet). It returns the entire string if no character in lpszCharSet is found in the string. 

解决方案 »

  1.   

    int CString::Remove( TCHAR ch );更方便....
      

  2.   

    CString youfunction(CString str)
    {
      CString re="";
      for (int=0;i<strlen(str);i++)
      {
          if((str[i]!=13 && str[i]!=10) &&str[i]!=32))
           re+=str[i];
       }
       return re;
    }
      

  3.   

    CString::TrimLeft
    void TrimLeft( );void CString::TrimLeft( TCHAR chTarget );void CString::TrimLeft( LPCTSTR lpszTargets );ParameterschTargetThe target characters to be trimmed.lpszTargetsA pointer to a string containing the target characters to be trimmed.Call the version of this member function with no parameters to trim leading whitespace characters from the string. When used with no parameters, TrimLeft removes newline, space, and tab characters. 
      

  4.   

    不能用int CString::Remove( TCHAR ch ); 该函数会使含有宽字符的CString出错。比如cs.Remove(' ');结果你会看到很多乱码。最好使用cs.Replace("\r\n","");//去回车
    cs.Replace(" ","");//去空格
    等等