請大家幫忙想想,對給定的文件文本的內容把裡面的符號,英文過濾掉,只剩下中文怎麼弄?
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s = "你好,我好。abc,123,aaa...中文英文!";
string r = "";
const char* c = s.c_str();
for (int i = 0; i < s.length(); i++)
{
if ((c[i] == -17 && c[i + 1] == -68) ||
(c[i] == -29 && c[i + 1] == -128) ||
(c[i] == -30 && c[i + 1] == -128))
{
i += 2;
continue;
}
if (c[i] > 256 || c[i] < 0)
{
r += c[i];
}
}
cout << r << endl;
}