在线文档教程
C++
字符串 | Strings

std::iswctype

STD::iswctype

Defined in header
int iswctype( std::wint_t wc, std::wctype_t desc

分类宽性wc使用当前C语言环境%27 s LC[医]C型类别desc...

参数

wc-the wide character to classify
desc-the LC_CTYPE category, obtained from a call to std::wctype

返回值

如果字符为非零ch是否将财产识别为desc在LC中[医]当前C语言环境的类型面,否则为零。

二次

#include <clocale> #include <cwctype> #include <iostream> bool classify(wchar_t wc, const std::string& cat) { return std::iswctype(wc, std::wctype(cat.c_str()) } int main() { std::setlocale(LC_ALL, "ja_JP.UTF-8" std::cout << "The character \u6c34 is...\n"; for(std::string s : {"digit", "alpha", "space", "cntrl", "jkanji"}) std::cout << s << "? " << std::boolalpha << classify(L'\u6c34', s) << '\n'; }

二次

产出:

二次

The character 水 is... digit? false alpha? true space? false cntrl? false jkanji? true

二次

另见

wctypelooks up a character classification category in the current C locale (function)

c iswc类型文档

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/string/Wide/iswctype