iswpunct Function

Test for a punctuation wide character.

Attention: This function is implemented only by MPLAB XC32 C compilers.




int iswpunct(wint_t wc);


The wide character to test.

Return Value

Returns a non-zero integer value if the wide character, wc, is a punctuation wide character; otherwise, returns a zero.


A wide character is considered to be a punctuation wide character if it is a printable wide character which is neither a space nor an alphanumeric wide character. Punctuation wide characters consist of the following:
L'!'  L'"'  L'#'  L'$'  L'%'  L'&'  L'''  L'('  L')'  L';'  L'<'  L'='  L'>'
L'?'  L'@'  L'['  L'\'  L']'  L'*'  L'+'  L','  L'-'  L'.'  L'/'  L':'  L'^'
L'_'  L'{'  L'|'  L'}'  L'~'


See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <wctype.h>
#include <stdio.h>
#include <stdbool.h>

int main(void)
  wint_t wStr[] = L"A string, 2 wide 4 some.\n";
  wint_t wc;
  unsigned idx = 0;
  bool found = false;

  do {
    wc = wStr[idx];
    if(iswpunct(wc)) {
      if( ! found)
        printf("Found matching wide char at position: ");
      printf("%s%u", found ? ", " : "", idx);
      found = true;
  } while(wStr[idx]);

Example Output

Found matching wide char at position: 8, 23