iswctype()函数在C++ STL中
在C++标准模板库(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是一种标量类型,用作wctype(宽字符类型)的返回值。
返回值
如果c确实具有由desc标识的属性,则为非零值(即为真)。否则为零(即为假)。
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.
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP