std::toupper(std::locale)
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    |   定义于头文件  <locale>
  | 
||
|   template< class charT > charT toupper( charT ch, const locale& loc );  | 
||
用给定 loacale 的 std::ctype 平面所指定的转换规则,若可能则转换字符 ch 为大写。
参数
| ch | - | 字符 | 
| loc | - | 本地环境 | 
返回值
若 ch 的大写形式列于 locale 则返回它,否则返回不更改的 ch 。
注意
此函数只能进行 1:1 字符映射,例如 'ß' 的大写形式(有一些例外)是双字符字符串 "SS" ,它无法以 do_toupper 获得。
可能的实现
template< class charT > charT toupper( charT ch, const std::locale& loc ) { return std::use_facet<std::ctype<charT>>(loc).toupper(ch); }  | 
示例
运行此代码
#include <iostream> #include <cwctype> #include <locale> int main() { wchar_t c = L'\u017f'; // 拉丁文小写字母长 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'; }
输出:
in the default locale, toupper(0x17f) = 0x17f in Unicode locale, toupper(0x17f) = 0x53
参阅
|   用本地环境的 ctype 刻面将字符转换为小写  (函数模板)  | |
|   转换字符为大写  (函数)  | |
|   转换宽字符为大写  (函数)  |