C examples for wctype.h:iswpunct
function
<cwctype> <wctype.h>
Check if wide character is punctuation character
int iswpunct (wint_t c);
Parameter | Description |
---|---|
c | Wide character to be checked |
A non zero value (i.e., true) if c is a punctuation character. Zero (i.e., false) otherwise.
#include <stdio.h> #include <wctype.h> int main ()/*w w w . ja v a 2s . co m*/ { int i=0; int cx=0; wchar_t str[] = L"this is a test! **&^*&^%$#%$#@!~"; while (str[i]) { if (iswpunct(str[i])) cx++; i++; } wprintf (L"The sentence contains %d punctuation characters.\n", cx); return 0; }