towupper
来自cppreference.com
| 在标头 <wctype.h> 定义
|
||
| |
(C95 起) | |
若可能则转换给定的宽字符为大写。
参数
| wc | - | 要转换的宽字符 |
返回值
wc 的大写版本,或若无大写版本列于当前 C 本地环境,则为不修改的 wc。
注意
此函数只能进行 1:1 映射,例如 'ß' 的大写形式(有一些例外)是双字符字符串 "SS",它无法通过 towupper 获得。
ISO 30112 指定此映射包含哪些 Unicode 字符对。
示例
运行此代码
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <locale.h>
int main(void)
{
wchar_t wc = L'\u017f'; // 拉丁文小写字母长 S ('ſ')
printf("in the default locale, towupper(%#x) = %#x\n", wc, towupper(wc));
setlocale(LC_ALL, "en_US.utf8");
printf("in Unicode locale, towupper(%#x) = %#x\n", wc, towupper(wc));
}
输出:
in the default locale, towupper(0x17f) = 0x17f
in Unicode locale, towupper(0x17f) = 0x53