我想要在一个字符串 CString strText = L"dsfd暗黑dsfd三等奖"; 中只获取中文字符。
不想用mid函数,因为这个函数必须要知道中文的位置。以下是我在别的博友那里看到的,并且稍作处理的。
CString strText = L"dfds大是大非df水电费";
CString strPasingText = L"";
for(int i = 0 ; i <strText.GetLength();i++)
{
int unicode = (int)strText.GetAt(i);
if (unicode > 255)
{
strPasingText += strText.GetAt(i);
}
}