towlower

< c‎ | string‎ | wide
定义于头文件 <wctype.h>
wint_t towlower( wint_t wc );
(C95 起)

若可能,则转换给定宽字符为小写。

参数

ch - 要转换的宽字符

返回值

ch 的小写版本,或若无小写版本列于当前 C 本地环境,则为不修改的 ch

注意

此函数只能进行 1:1 字符映射,例如希腊大写字母 'Σ' 拥有二个小写形式,依赖在词中的位置: 'σ' 与 'ς' 。此情况下,不能用对 towlower 的调用获得正确的小写形式。

ISO 30112 指定此映射包含哪些 Unicode 字符对。

示例

#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <locale.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

引用

  • C11 standard (ISO/IEC 9899:2011):
  • 7.30.3.1.1 The towlower function (p: 453)
  • C99 standard (ISO/IEC 9899:1999):
  • 7.25.3.1.1 The towlower function (p: 399)

参阅

将宽字符转换为大写
(函数)
将字符转换成小写
(函数)