C/C++ 中的 iswpunct() 函数
函数 iswpunct() 用于检查传递的宽字符是否是标点符号。如果不是标点符号则返回零,否则返回非零值。它在 “cwctype” 头文件声明中。
以下是 iswpunct() 的语法
int iswpunct(wint_t character);
以下是 iswpunct() 的示例
示例
#include<cwctype>
#include<stdio.h>
using namespace std;
int main() {
wint_t a = '!';
wint_t b = 'a';
if(iswpunct(a))
printf("The character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
if(iswpunct(b))
printf("\nThe character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
return 0;
}输出
The character is a punctuation. The character is not a punctuation.
在上面的程序中,两个宽字符分别声明为 a 和 b。字符检查传递的字符是否是标点符号。
wint_t a = '!';
wint_t b = 'a';
if(iswpunct(a))
printf("The character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
if(iswpunct(b))
printf("\nThe character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP