有现成的函数吗?

解决方案 »

  1.   

    String str;
    if(str.Trim().Length()==str.Length())
       ShowMessage("没空格");
    else
       ShowMessage("有空格");
      

  2.   

    CString::Find 
    int Find( TCHAR ch ) const;int Find( LPCTSTR lpszSub ) const;int Find( TCHAR ch, int nStart ) const;int Find( LPCTSTR pstr, int nStart ) const;
      

  3.   

    std::string str ;
    str.find() ;
      

  4.   

    cstring str;
    str.find(" ",0);
      

  5.   

    CString str ="sth";if(str.find(' ') == -1)
    {
    AfxMessageBox("无空格");
    }
    else
    {
    AfxMessageBox("有空格");
    }