上面的代码是去处edit中的所有的汉字!

来源:互联网 发布:淘宝头条能做淘客吗 编辑:程序博客网 时间:2024/04/30 13:27
void   CHanZiDlg::ParseCharacter(   const   char   *str,CString   *pstrResult)
{
    int   len=strlen(str);
    const   char   *pch=str;
    *pstrResult= " ";
    for(int   index=0;index <len;index++)
    {
if((*pch&128))//,高位为1,发现汉字,去除掉!
    pch++;
else
    *pstrResult+=*pch++;
    }
}
void   CHanZiDlg::OnButton2()  
{
//   TODO:   Add   your   control   notification   handler   code   here
CString   str;
CString   strResult;
this-> m_EditCtrl.GetWindowText(str);
this-> ParseCharacter((LPCSTR)str,&strResult);
MessageBox(strResult);
}
----------------
上面的代码是去处edit中的所有的汉字!
你可以改一下呀!
实际上汉字的高位是1,