| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Functions | ||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||
| Array manipulation | ||||||||||||||||||||||||||
Defined in header <cwctype> | ||
int iswctype(std::wint_t wc,std::wctype_t desc); | ||
Classifies the wide characterwc using the current C locale'sLC_CTYPE category identified bydesc.
If the value ofwc is neither representable as awchar_t nor equal to the value of the macroWEOF, the behavior is undefined.
Contents |
| wc | - | the wide character to classify |
| desc | - | theLC_CTYPE category, obtained from a call tostd::wctype |
Non-zero if the characterwc has the property identified bydesc inLC_CTYPE facet of the current C locale, zero otherwise.
#include <clocale>#include <cwctype>#include <iostream> bool classify(wchar_t wc,conststd::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';}
Output:
The character 水 is...digit? falsealpha? truespace? falsecntrl? falsejkanji? true
| looks up a character classification category in the current C locale (function)[edit] | |
C documentation foriswctype | |