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

std::isalnum(std::locale)

Defined in header <locale>

?

?

template< class charT > bool isalnum( charT ch, const locale& loc );

?

?

检查给定字符是否按给定的区域设置%27s分类为字母数字字符std::ctype小面。

参数

ch

-

character

loc

-

locale

返回值

回报true如果该字符被归类为字母数字,false否则。

可能的实施

模板<class图表>bool isalnum%28图表ch,Const std::locale&loc%29{返回std::use[医]facet<std::Ctype<charT>>%28 loc%29 is%28 std::Ctype[医]碱::铝,CH%29;}

*。

演示使用不同区域设置的isalnum%28%29-特定于%29的区域设置。

二次

代码语言:javascript
复制
#include <iostream>
#include <locale>
int main()
{
    const wchar_t c = L'\u2135'; // mathematical symbol aleph
 
    std::locale loc1("C");
    std::cout << "isalnum('?', C locale) returned "
               << std::boolalpha << std::isalnum(c, loc1) << '\n';
 
    std::locale loc2("en_US.UTF-8");
    std::cout << "isalnum('?', Unicode locale) returned "
              << std::boolalpha << std::isalnum(c, loc2) << '\n';
}

二次

产出:

二次

代码语言:javascript
复制
isalnum('??', C locale) returned false
isalnum('?', Unicode locale) returned true

二次

另见

isalnum

checks if a character is alphanumeric (function)

iswalnum

checks if a wide character is alphanumeric (function)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com