std:: iswctype
From cppreference.net
C++
Text processing library
| 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 | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Null-terminated wide strings
| Functions | ||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||
| Array manipulation | ||||||||||||||||||||||||||
|
定义于头文件
<cwctype>
|
||
|
int
iswctype
(
std::
wint_t
wc,
std::
wctype_t
desc
)
;
|
||
使用由 desc 标识的当前C本地环境的 LC_CTYPE 类别对宽字符 wc 进行分类。
如果 wc 的值既不能表示为 wchar_t 类型,也不等于宏 WEOF 的值,则行为是未定义的。
目录 |
参数
| wc | - | 待分类的宽字符 |
| desc | - | 通过调用 std::wctype 获得的 LC_CTYPE 类别描述符 |
返回值
若字符 wc 在当前 C 区域设置的 LC_CTYPE 分类中具有 desc 所标识的属性,则返回非零值,否则返回零。
示例
运行此代码
#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'; }
输出:
字符 水 是... digit? false alpha? true space? false cntrl? false jkanji? true
参见
|
在当前C语言区域中查找字符分类类别
(函数) |
|
|
C 文档
关于
iswctype
|
|