towlower
来自cppreference.com
| 在标头 <wctype.h> 定义
|
||
| |
(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'; // 拉丁文大写字母开 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 The towlower function (第 TBD 页)
- C17 标准(ISO/IEC 9899:2018):
- 7.30.3.1.1 The towlower function (第 TBD 页)
- C11 标准(ISO/IEC 9899:2011):
- 7.30.3.1.1 The towlower function (第 453 页)
- C99 标准(ISO/IEC 9899:1999):
- 7.25.3.1.1 The towlower function (第 399 页)
参阅
(C95) |
转换宽字符为大写 (函数) |
| 将字符转换成小写 (函数) | |
towlower 的 C++ 文档
| |