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