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.
The LC_CTYPE or LC_UNI_CTYPE category of the active locale determines the results returned from these functions.
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
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.