函數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.");
以上是在C/C++中,iswpunct()函數的作用是判斷一個寬字元是否為標點符號的詳細內容。更多資訊請關注PHP中文網其他相關文章!