C ++ STL中的Iswctype()函数
在C++标准模板libraray(STL)中,iswctype()函数用于检查给定的宽字符是否具有desc指定的属性。
Iswctype()是一个内置函数,其头文件为“ctype.h”。
Iswctype()的语法如下
int iswctype(wint_t c, wctype_t desc); iswctype () / Checks whether whether c has the property specified by desc. /
概要
int iswctype(wint_t c, wctype_t desc);
参数
C-检查转换为整数类型wint_t的宽字符
Desc-它是调用wctype返回的值,这是一个标量类型,用作wctype(宽字符类型)的返回类型。
返回值
如果c确实具有由desc标识的属性,则该值不同于零(即true)。否则为零(即false)。
C中的ISWCTYPE()函数的程序
#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.
热门推荐
10 岳母生日贺卡祝福语简短
11 女孩自己生日祝福语简短
12 简短的几句新年祝福语
13 难过生日祝福语简短
14 班级祝福语简短句子
15 钢琴获奖老师祝福语简短
16 蛋糕班级新年祝福语简短
17 小班小孩生日祝福语简短
18 厨房祝福语简短100句