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,
{
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,