在 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(宽字符类型)的返回类型。
返回值
如果 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.
相关用法
- C++ Implementing of strtok()用法及代码示例
- C++ INT_MIN用法及代码示例
- C++ INT_MAX用法及代码示例
- C++内联函数用法及代码示例
- C++ unordered_map cbegin用法及代码示例
- C++ map lower_bound()用法及代码示例
- C++ Unordered_multimap reserve()用法及代码示例
- C++ list assign()用法及代码示例
- C++ std::max()用法及代码示例
- C++ std::string::push_back()用法及代码示例
- C++ Array swap()用法及代码示例
- C++ multimap key_comp()用法及代码示例
- C++ Deque erase()用法及代码示例
- C++ List cend()用法及代码示例
- C++ std::less_equal用法及代码示例
- C++ set rbegin()用法及代码示例
- C++ llround()用法及代码示例
- C++ getline(string)用法及代码示例
- C++ boost::algorithm::all_of()用法及代码示例
- C++ string::length()用法及代码示例
注:本文由纯净天空筛选整理自Sunidhi Bansal大神的英文原创作品 Iswctype() function in C++ STL。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。