Xi Xu's More Things

towlower

来自cppreference.com
< c‎ | string‎ | wide
 
 
 
空终止宽字符串
函数
字符操作
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)
(C99)
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)
towlower
(C95)
(C95)
(C95)
(C95)
转换成数值格式
(C95)(C99)
(C95)(C99)
(C99)(C95)(C99)
(C99)(C99)
字符串操作
(C95)(C11)
(C95)(C11)
(C95)(C11)
(C95)(C11)
(C95)(C11)
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)
(C95)(C11)
数组操作
(C95)(C11)
(C95)(C11)
(C95)
(C95)
(C95)
 
在标头 <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 标准(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)
将宽字符转换为大写
(函数)
将字符转换成小写
(函数)