wctrans
決定將一組字元碼對應至另一個。
語法
wctrans_t wctrans(
const char *property
);
參數
property
指定其中一個有效轉換的字串。
傳回值
LC_CTYPE
如果目前地區設定的類別未定義名稱符合屬性字串 property
的對應,則函式會傳回零。 否則,它會傳回適合做為後續呼叫 towctrans
的第二個引數的非零值。
備註
此函式決定將一組字元碼對應至另一個。
下列配對的呼叫在所有地區設定中都有相同的行為,但即使在 「C」 地區設定中,也可以定義更多對應:
函式 | 同於 |
---|---|
tolower(c) |
towctrans(c, wctrans("towlower")) |
towupper(c) |
towctrans(c, wctrans("toupper")) |
需求
常式 | 必要的標頭 |
---|---|
wctrans |
<wctype.h> |
如需相容性詳細資訊,請參閱相容性。
範例
// crt_wctrans.cpp
// compile with: /EHsc
// This example determines a mapping from one set of character
// codes to another.
#include <wchar.h>
#include <wctype.h>
#include <stdio.h>
#include <iostream>
int main()
{
wint_t c = 'a';
printf_s("%d\n",c);
wctrans_t i = wctrans("toupper");
printf_s("%d\n",i);
wctrans_t ii = wctrans("towlower");
printf_s("%d\n",ii);
wchar_t wc = towctrans(c, i);
printf_s("%d\n",wc);
}
97
1
0
65
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應