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

std::ispunct(std::locale)

Defined in header <locale>

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

检查给定字符是否被给定的区域设置%27s归类为标点符号std::ctype小面。

参数

ch

-

character

loc

-

locale

返回值

回报true如果字符被归类为标点符号,false否则。

可能的实施

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

*。

演示在不同地区使用ispoint%28%29的用法--特定于%28 OS的%29。

二次

代码语言:javascript
复制
#include <iostream>
#include <locale>
int main()
{
    const wchar_t c = L'\u214b'; // upside-down ampersand
 
    std::locale loc1("C");
    std::cout << "ispunct('⅋', C locale) returned "
               << std::boolalpha << std::ispunct(c, loc1) << '\n';
 
    std::locale loc2("en_US.UTF-8");
    std::cout << "ispunct('⅋', Unicode locale) returned "
              << std::boolalpha << std::ispunct(c, loc2) << '\n';
}

二次

产出:

二次

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

二次

另见

ispunct

checks if a character is a punctuation character (function)

iswpunct

checks if a wide character is a punctuation character (function)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券