VC判斷字符串是否有中文

CString strTemp,str,strs;

strTemp="A-1-B-2什麼56-A“;

int i=0;

int nLen=strTemp.GetLength();

for(i=0;i<nLen;i++)

   char ch=strTemp.GetAt(i);

 if(IsDBCSleadByte(ch))//判斷雙字節首大於   0x80

   {

       str=strTemp.Mid(i,2);//取從i開始的2個字節

       i++;

       strs+=str;

      }

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章