在网上看到一段代码
void CdemoDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
CString strinput;
GetDlgItemText(IDC_EDIT1, strinput);
int nlen = strinput.GetLength();
int ncount = 0;
for (int i = 0; i < nlen; i++)
{
if ((BYTE)strinput[i] > 0x7f)
{
++i;
}
ncount++;
}
CString stroutput;
stroutput.Format(_T("字符串长度:%d,字符个数:%d"),nlen, ncount);
SetDlgItemText(IDC_STATIC_OUTPUT,stroutput);
}
其中for循环是为了在使用多字节的时候,正确识别两个汉字算一个字符,在多字节中,一个汉字算两个字符,for循环是判断两个字符中是否有大于127?请详细讲解一下,为什么这么判断