在线文档教程
C

towupper

towupper

在头文件中定义
win_t towupper(wint_t wc);(自C95以来)

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

参数

wc-宽字符被转换

返回值

如果在当前C语言环境中wcwc列出大写版本,则为大写版本或未修改。

注意

该函数只能执行1:1的字符映射,例如,'ß'的大写形式是(有些例外)双字符字符串“SS”,这是无法通过该函数获得的towupper

示例

#include <stdio.h> #include <wchar.h> #include <wctype.h> #include <locale.h> int main(void) { wchar_t wc = L'\u017f'; // Latin small letter Long 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

参考

  • C11标准(ISO/IEC 9899:2011):

See also

towlower (C95)converts a wide character to lowercase (function)
toupperconverts a character to uppercase (function)

| C++ documentation for towupper |

© cppreference.com

Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.

http://en.cppreference.com/w/c/string/wide/towupper