📅  最后修改于: 2020-09-25 10:29:29             🧑  作者: Mango
iswpunct() 函数在
int iswpunct(wint_t ch);
iswpunct() 函数检查ch
是否为标点字符 。默认情况下,标点字符
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~.
#include
#include
#include
using namespace std;
int main()
{
setlocale(LC_ALL, "en_US.UTF-8");
wchar_t ch1 = L'\u0938';
wchar_t ch2 = L'\u007e';
iswpunct(ch1) ? wcout << ch1 << L" is a punctuation character" : wcout << ch1 << L" is not a punctuation character";
wcout << endl;
iswpunct(ch2) ? wcout << ch2 << L" is a punctuation character" : wcout << ch2 << L" is not a punctuation character";
return 0;
}
运行该程序时,输出为:
स is not a punctuation character
~ is a punctuation character