首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::iswctype

Defined in header <cwctype>

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语言环境的类型面,否则为零。

二次

代码语言:javascript
复制
#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';
}

二次

产出:

二次

代码语言:javascript
复制
The character 水 is...
digit? false
alpha? true
space? false
cntrl? false
jkanji? true

二次

另见

wctype

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

c iswc类型文档

代码语言:txt
复制
 © cppreference.com

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

扫码关注腾讯云开发者

领取腾讯云代金券