MFC中判断一个字符时中文还是英文

CString  tempContent="判断是中文还是english";
 char temp_1charbuf,temp_2charbuf;
 int i=0;
 int m_count=tempContent.GetLength();
 char tempChar_1,tempChar_2;
 for(;i<m_count;)
 { 
  tempChar_1=tempContent.GetAt(i);
  if (tempChar_1 < 0x80 && tempChar_1 >= 0x0)
  {
   tempstr.AppendChar(tempChar_1);
   i++;
   AfxMessageBox("digit or english character");
  }
  else
  {
   tempChar_2 = tempContent.GetAt(i+1);
   tempContent.AppendFormat("%c%c",tempChar_1,tempChar_2);
   i+=2;
   AfxMessageBox("中文");
  }

posted @ 2013-01-22 13:53  iosJohnson  阅读(856)  评论(0)    收藏  举报