towlower
來自 cppreference.com
在標頭檔案 <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: 待定)
- C17 標準 (ISO/IEC 9899:2018)
- 7.30.3.1.1 towlower 函式 (p: 待定)
- 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
|