std::iswctype
cppreference.com
<tbody>
</tbody>
int iswctype( std::wint_t wc, std::wctype_t desc ); |
||
wc, LC_CTYPE C, desc.
wc wchar_t WEOF, .
| wc | ||
| desc | LC_CTYPE, std::wctype |
, wc , desc LC_CTYPE 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 << " \u6c34 ...\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
| C () | |
C iswctype
| |