6.24.9 iswctype Function

Test the property of a wide character.

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

Include

<wctype.h>

Prototype

int iswctype(wint_t wc, wctype_t desc);

Arguments

wc
The wide character to test.
desc
The wide character property to test for.

Return Value

Returns a non-zero integer value if the wide character, wc, has the property described by desc; otherwise, returns a zero.

Remarks

See wctype Function, which can be used to obtain a description of the desired wide character property.

Example

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)
{
  wchar_t wStr[] = L"A string, 2 wide 4 some.\n";
  wint_t wc;
  unsigned idx = 0;
  bool found = false;

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

Example Output

Found matching wide char at position: 1, 9, 11, 16, 18, 24