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);
}