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

std::towupper

Defined in header <cwctype>

std::wint_t towupper( std::wint_t ch );

如果可能,将给定的宽字符转换为大写。

参数

ch

-

wide character to be converted

返回值

大写版本ch或未经修改ch如果当前C语言环境中没有大写版本列出。

注记

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

拉丁文字母%27%27%28U+017F%29是%27s%27%28U+0053%29的可选小写形式。

二次

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

二次

产出:

二次

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

二次

另见

towlower

converts a wide character to lowercase (function)

toupper(std::locale)

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

toupper

converts a character to uppercase (function)

C拖曳文件

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

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

扫码关注腾讯云开发者

领取腾讯云代金券