首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

以unicode为内容的CString如何查找匹配的字符串

2012-10-19 
以unicode为内容的CString怎么查找匹配的字符串WCHAR *pUnicode new WCHAR[unicodeLen+1]CString str(pU

以unicode为内容的CString怎么查找匹配的字符串
WCHAR *pUnicode =new WCHAR[unicodeLen+1];
CString str(pUnicode);
CString的内容为unicode编码的,所以是用了wchar数组存然后又导到CString中去,str用Find提示没有和参数wchar_t相匹配的重载函数,要对str内容字符串匹配查找应该怎么做。

[解决办法]
不用转了:

C/C++ code
// First example demonstrating // CString::Find ( TCHAR ch )CString s( "abcdef" );ASSERT( s.Find( 'c' ) == 2 );ASSERT( s.Find( "de" ) == 3 );// Second example demonstrating // CString::Find( TCHAR ch, int nStart )CString str("The stars are aligned");int n = str.Find('e', 5);ASSERT(n == 12); 

热点排行