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.

Locale Sensitive: The behavior of these functions might be affected by the LC_CTYPE category of the current locale if LOCALETYPE(*LOCALE) is specified on the compilation command. The behavior of these functions might be affected by the LC_UNI_CTYPE category of the current locale if either the LOCALETYPE(*LOCALEUCS2) option or the LOCALETYPE(*LOCALEUTF) option is specified on the compilation command. These functions are not available when LOCALETYPE(*CLD) is specified on the compilation command. For more information, see Understanding CCSIDs and Locales.

Wide Character Function: See Wide Characters for more information.

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.

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 current locale.
iswcntrl()
Test for a wide control character, as defined in the cntrl class of the current locale.
iswdigit()
Test for a wide decimal-digit character: 0 through 9, as defined in the digit class of the current locale.
iswgraph()
Test for a wide printing character, not a space, as defined in the graph class of the current locale.
iswlower()
Test for a wide lowercase character, as defined in the lower class of the current locale or for which none of the iswcntrl(), iswdigit(), iswspace() functions are true.
iswprint()
Test for any wide printing character, as defined in the print class of the current locale.
iswpunct()
Test for a wide nonalphanumeric, nonspace character, as defined in the punct class of the current locale.
iswspace()
Test for a wide whitespace character, as defined in the space class of the current locale.
iswupper()
Test for a wide uppercase character, as defined in the upper class 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 current locale.

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 | Contents | Index ]