c 大小写转换

/* towctrans example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
    int i=0;
    wchar_t str[] = L"Test String.
";
    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); /* 将要使用的函数传入转换函数 */
        }
        putchar (c);  /*输出 c */
        i++;
    }
    return 0;
}
原文地址:https://www.cnblogs.com/sea-stream/p/10893322.html