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

std::toupper(std::locale)

Defined in header <locale>

?

?

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

?

?

转换字符ch如果可能的话,使用由给定的区域设置%27s指定的转换规则大写std::ctype小面。

参数

ch

-

character

loc

-

locale

返回值

返回大写形式的ch如果在区域设置中列出了一个,则返回ch没有变化。

注记

这个函数只能执行01:1的字符映射,例如,大写形式%27%27是%28,但有一些例外,即双字符字符串“ss”,它不能由std::toupper...

可能的实施

模板<类图表>图表摸图%28图表ch,Const std::locale&loc%29{返回std::use[医]facet<std::Ctype<charT>>%28 loc%29。拉皮尔%28ch%29;}

*。

二次

代码语言:javascript
复制
#include <iostream>
#include <cwctype>
#include <locale>
 
int main()
{
    wchar_t c = L'\u017f'; // Latin small letter Long S ('?')
 
    std::cout << std::hex << std::showbase;
 
    std::cout << "in the default locale, toupper(" << (std::wint_t)c << ") = "
              << std::toupper(c, std::locale()) << '\n';
 
    std::cout << "in Unicode locale, toupper(" << (std::wint_t)c << ") = "
              << std::toupper(c, std::locale("en_US.utf8")) << '\n';
}

二次

产出:

二次

代码语言:javascript
复制
in the default locale, toupper(0x17f) = 0x17f
in Unicode locale, toupper(0x17f) = 0x53

二次

另见

tolower(std::locale)

converts a character to lowercase using the ctype facet of a locale (function template)

toupper

converts a character to uppercase (function)

towupper

converts a wide character to uppercase (function)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com