ILE C/C++ Run-Time Library Functions


iswalnum() to iswxdigit() -- Test Wide Integer Value

Format

#include <wctype.h>
int iswalnum(wint_t wc);
int iswalpha(wint_t wc);
int iswcntrl(wint_t wc);
int iswdigit(wint_t wc);
int iswgraph(wint_t wc);
int iswlower(wint_t wc);
int iswprint(wint_t wc);
int iswpunct(wint_t wc);
int iswspace(wint_t wc);
int iswupper(wint_t wc);
int iswxdigit(wint_t wc);
 

Language Level: ANSI

Threadsafe: Yes.

Description

The functions listed above, which are all declared in <wctype.h>, test a given wide integer value.

The value of wc must be a wide-character code corresponding to a valid character in the current locale, or must equal the value of the macro WEOF. If the argument has any other value, the behavior is undefined.

If the program is compiled with LOCALETYPE(*LOCALEUCS2) or LOCALETYPE(*LOCALEUTF), the wide character properties are those defined by the LC_UNI_CTYPE category of the current locale.

Here are descriptions of each function in this group.

iswalnum()
Test for a wide alphanumeric character.

iswalpha()
Test for a wide alphabetic character, as defined in the alpha class of the LC_CTYPE category of the current locale.

iswcntrl()
Test for a wide control character, as defined in the cntrl class of the LC_CTYPE category of the current locale.

iswdigit()
Test for a wide decimal-digit character: 0 through 9, as defined in the digit class of the LC_CTYPE category of the current locale.

iswgraph()
Test for a wide printing character, not a space, as defined in the graph class of the LC_CTYPE category of the current locale.

iswlower()
Test for a wide lowercase character, as defined in the lower class of the LC_CTYPE category of the current locale or for which none of the iswcntrl(), iswdigit(), iswspace() function are true.

iswprint()
Test for any wide printing character, as defined in the print class of the LC_CTYPE category of the current locale.

iswpunct()
Test for a wide non-alphanumeric, non-space character, as defined in the punct class of the LC_CTYPE category of the current locale.

iswspace()
Test for a wide whitespace character, as defined in the space class of the LC_CTYPE category of the current locale.

iswupper()
Test for a wide uppercase character, as defined in the upper class of the LC_CTYPE category of the current locale.

iswxdigit()
Test for a wide hexadecimal digit 0 through 9, a through f, or A through F. as defined in the xdigit class of the LC_CTYPE category of the current locale.

The LC_CTYPE or LC_UNI_CTYPE category of the active locale determines the results returned from these functions.

Note:
The <wctype.h> functions are not available when LOCALETYPE(*CLD) is specified on the compilation command.

Returned Value

These functions return a nonzero value if the wide integer satisfies the test value, or a 0 value if it does not. The value for wc must be representable as a wide unsigned char. WEOF is a valid input value.

Example


#include <stdio.h>
#include <wctype.h>
 
int main(void)
{
   int wc;
 
   for (wc=0; wc <= 0xFF; wc++) {
      printf("%3d", wc);
      printf(" %#4x ", wc);
      printf("%3s", iswalnum(wc)  ? "AN" : " ");
      printf("%2s", iswalpha(wc)  ? "A"  : " ");
      printf("%2s", iswcntrl(wc)  ? "C"  : " ");
      printf("%2s", iswdigit(wc)  ? "D"  : " ");
      printf("%2s", iswgraph(wc)  ? "G"  : " ");
      printf("%2s", iswlower(wc)  ? "L"  : " ");
      printf(" %c", iswprint(wc)  ? wc   : ' ');
      printf("%3s", iswpunct(wc)  ? "PU" : " ");
      printf("%2s", iswspace(wc)  ? "S"  : " ");
      printf("%3s", iswprint(wc)  ? "PR" : " ");
      printf("%2s", iswupper(wc)  ? "U"  : " ");
      printf("%2s", iswxdigit(wc) ? "X"  : " ");
 
      putchar('\n');
   }
}

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]