C語言wctype頭文件(wctype.h)中wctrans函數的用法及代碼示例。
用法:
wctrans_t wctrans (const char* property);
返回字符轉換
特定的語言環境可以接受字符的多種轉換。至少所有區域設置都可以識別以下轉換:
字符串作為屬性 | 描述 | 等效函數 |
---|---|---|
"tolower" | 小寫 | towlower |
"toupper" | 大寫 | towupper |
此函數返回的值取決於LC_CTYPE locale選擇的類別。
參數
- property
- 標識字符轉換的字符串(請參見上文)。
返回值
類型值wctrans_t識別特定的字符類別。此值為locale-dependent。
示例
/* wctrans example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
int i=0;
wchar_t str[] = L"Test String.\n";
wchar_t c;
wctype_t check = wctype("lower");
wctrans_t trans = wctrans("toupper");
while (str[i])
{
c = str[i];
if (iswctype(c,check)) c = towctrans(c,trans);
putwchar (c);
i++;
}
return 0;
}
輸出:
TEST STRING. |
相關用法
- C語言 iswalnum用法及代碼示例
- C語言 iswalpha用法及代碼示例
- C語言 iswblank用法及代碼示例
- C語言 iswcntrl用法及代碼示例
- C語言 iswdigit用法及代碼示例
- C語言 iswgraph用法及代碼示例
- C語言 iswlower用法及代碼示例
- C語言 iswprint用法及代碼示例
- C語言 iswpunct用法及代碼示例
- C語言 iswspace用法及代碼示例
- C語言 iswupper用法及代碼示例
- C語言 iswxdigit用法及代碼示例
- C語言 towlower用法及代碼示例
- C語言 towupper用法及代碼示例
- C語言 iswctype用法及代碼示例
- C語言 towctrans用法及代碼示例
- C語言 wctype用法及代碼示例
注:本文由純淨天空篩選整理自C標準庫大神的英文原創作品 C wctrans function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。