String.toupper метод
COLOPHON top
This page is part of release 5.08 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU 2017-09-15 TOUPPER(3)
Pages that refer to this page:
isalnum(3),
isalnum_l(3),
isalpha(3),
isalpha_l(3),
isascii(3),
isascii_l(3),
isblank(3),
isblank_l(3),
iscntrl(3),
iscntrl_l(3),
isdigit(3),
isdigit_l(3),
isgraph(3),
isgraph_l(3),
islower(3),
islower_l(3),
isprint(3),
isprint_l(3),
ispunct(3),
ispunct_l(3),
isspace(3),
isspace_l(3),
isupper(3),
isupper_l(3),
isxdigit(3),
isxdigit_l(3),
toascii(3),
towlower(3),
towlower_l(3),
wctrans(3)
备注Remarks
如果可行且恰当,则其中的各个例程将指定小写字母转换为大写字母。Each of these routines converts a given lowercase letter to an uppercase letter if possible and appropriate. Towupper的大小写转换是特定于区域设置的。The case conversion of towupper is locale-specific. 只改变与当前区域设置相关的字符的大小写。Only the characters relevant to the current locale are changed in case. 没有 _l后缀的函数使用当前设置的区域设置。The functions without the _l suffix use the currently set locale. 这些具有 _l后缀的函数的版本将区域设置用作参数,并使用该区域设置,而不是使用当前设置的区域设置。The versions of these functions with the _l suffix take the locale as a parameter and use that instead of the currently set locale. 有关详细信息,请参阅 Locale。For more information, see Locale.
为了使toupper能够提供预期的结果, __isascii和isupper都必须返回非零值。In order for toupper to give the expected results, __isascii and isupper must both return nonzero.
默认情况下,此函数的全局状态的作用域限定为应用程序。By default, this function’s global state is scoped to the application. 若要更改此项,请参阅CRT 中的全局状态。To change this, see Global state in the CRT.
一般文本例程映射Generic-Text Routine Mappings
TCHAR.H 例程TCHAR.H routine | 未定义 _UNICODE 和 _MBCS_UNICODE & _MBCS not defined | 已定义 _MBCS_MBCS defined | 已定义 _UNICODE_UNICODE defined |
---|---|---|---|
_totupper_totupper | touppertoupper | _mbctoupper_mbctoupper | towuppertowupper |
_totupper_l_totupper_l | _toupper_l_toupper_l | _mbctoupper_l_mbctoupper_l | _towupper_l_towupper_l |
备注
_toupper_l和 _towupper_l没有区域设置依赖关系,因此不应直接调用。_toupper_l and _towupper_l have no locale dependence and are not meant to be called directly. 它们由 _totupper_l供内部使用。They are provided for internal use by _totupper_l.
NOTES top
The standards require that the argument c for these functions is either EOF or a value that is representable in the type unsigned char. If the argument c is of type char, it must be cast to unsigned char, as in the following example: char c; ... res = toupper((unsigned char) c); This is necessary because char may be the equivalent signed char, in which case a byte where the top bit is set would be sign extended when converting to int, yielding a value that is outside the range of unsigned char. The details of what constitutes an uppercase or lowercase letter depend on the locale. For example, the default "C" locale does not know about umlauts, so no conversion is done for them. In some non-English locales, there are lowercase letters with no cor‐ responding uppercase equivalent; the German sharp s is one example.