Home C&C++函数库 c++ 语法 程序源码 Linux C库

wctrans

函数   <cwctype>

wctrans_t wctrans (const char* property);

返回字符转换属性

返回类型为wctrans_t的值, 该值对应于字符转换属性。

特定的区域设置可以接受字符的多种转换。至少以下转换可以被所有地区识别:

作为属性传递的字符串 说明 等效函数
"tolower" 转小写 towlower
"toupper" 转大写 towupper


这个函数返回的值取决于所选的LC_CTYPE区域类别的设置

☲  参数


property
标识字符转换的字符串(参见上面)。

☉  返回值



类型为wctrans_t的值,用于标识特定字符类别。

该值依赖于区域设置。

☣  示例



/* 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.

🍄  另请参阅



towctrans 使用转换设置转换(function )
wctype 返回宽字符类型属性(function )
iswupper 检查宽字符是否为大写字母(function )
iswlower 检查宽字符是否为小写字母(function )

联系我们 免责声明 关于CandCplus 网站地图