towlower
出自 cppreference.cn
定义于头文件 <wctype.h> |
||
wint_t towlower( wint_t wc ); |
(始于 C95) | |
如果可能,将给定的宽字符转换为小写。
目录 |
[编辑] 参数
wc | - | 要转换的宽字符 |
[编辑] 返回值
wc 的小写版本;如果当前 C 语言环境未列出小写版本,则返回未修改的 wc。
[编辑] 注解
此函数只能执行 1:1 字符映射,例如,希腊大写字母 'Σ' 有两种小写形式,具体取决于在单词中的位置:'σ' 和 'ς'。 在这种情况下,调用 towlower
不能用于获得正确的小写形式。
ISO 30112 规定了此映射中包含哪些 Unicode 字符对。
[编辑] 示例
运行此代码
#include <locale.h> #include <stdio.h> #include <wchar.h> #include <wctype.h> int main(void) { wchar_t wc = L'\u0190'; // Latin capital open E ('Ɛ') printf("in the default locale, towlower(%#x) = %#x\n", wc, towlower(wc)); setlocale(LC_ALL, "en_US.utf8"); printf("in Unicode locale, towlower(%#x) = %#x\n", wc, towlower(wc)); }
输出
in the default locale, towlower(0x190) = 0x190 in Unicode locale, towlower(0x190) = 0x25b
[编辑] 参考文献
- C23 标准 (ISO/IEC 9899:2024)
- 7.30.3.1.1 towlower 函数 (p: TBD)
- C17 标准 (ISO/IEC 9899:2018)
- 7.30.3.1.1 towlower 函数 (p: TBD)
- C11 标准 (ISO/IEC 9899:2011)
- 7.30.3.1.1 towlower 函数 (p: 453)
- C99 标准 (ISO/IEC 9899:1999)
- 7.25.3.1.1 towlower 函数 (p: 399)
[编辑] 参见
(C95) |
将宽字符转换为大写 (函数) |
将字符转换为小写 (函数) | |
C++ 文档 关于 towlower
|