Syntax
#include <wctype.h> wctype_t wctype(const char *property);Description
wctype returns a handle for the specified character class from the LC_CTYPE category. You can then use this handle with the iswctype function to determine if a given wide character belongs to that class.
The following strings correspond to the standard (basic) character classes
or properties: cols='15 15 15 15'.
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ " ³
³ "alnum" ³
³ "alpha" ³
³ "blank" " ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ " ³
³ "cntrl" ³
³ "digit" ³
³ "graph" " ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ " ³
³ "lower" ³
³ "print" ³
³ "punct" " ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ " ³
³ "space" ³
³ "upper" ³
³ "xdigit" " ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
These classes are described in isalnum to isxdigit and iswalnum to iswxdigit.
You can also give the name of a user-defined class, as specified in a locale definition file, as the property argument.
The behavior of this wide-character function is affected by the LC_CTYPE category of the current locale.
wctype returns a value of type wctype_t that represents the property and can be used in calls to iswctype. If the given property is not valid for the current locale (LC_CTYPE category), wctype returns 0.
Values returned by wctype are valid until a call to setlocale that modifies the LC_CTYPE category.
This example uses wctype to return each standard property, and calls iswctype to test a wide character against each property.
#include <wctype.h> #include <stdio.h> #define UPPER_LIMIT 0xFF int main(void) { int wc; for (wc = 0; wc <= UPPER_LIMIT; wc++) { printf("%#4x ", wc); printf("%lc", iswctype(wc, wctype("print")) ? (wchar_t)wc : ' '); printf("%s", iswctype(wc, wctype("alnum")) ? " AN" : " "); printf("%s", iswctype(wc, wctype("alpha")) ? " A " : " "); printf("%s", iswctype(wc, wctype("blank")) ? " B " : " "); printf("%s", iswctype(wc, wctype("cntrl")) ? " C " : " "); printf("%s", iswctype(wc, wctype("digit")) ? " D " : " "); printf("%s", iswctype(wc, wctype("graph")) ? " G " : " "); printf("%s", iswctype(wc, wctype("lower")) ? " L " : " "); printf("%s", iswctype(wc, wctype("punct")) ? " PU" : " "); printf("%s", iswctype(wc, wctype("space")) ? " S " : " "); printf("%s", iswctype(wc, wctype("print")) ? " PR" : " "); printf("%s", iswctype(wc, wctype("upper")) ? " U " : " "); printf("%s", iswctype(wc, wctype("xdigit")) ? " X " : " "); putchar('\n'); } return 0; /**************************************************************************** The output should be similar to : : 0x1f C 0x20 B S PR 0x21 ! G PU PR 0x22 " G PU PR 0x23 # G PU PR 0x24 $ G PU PR 0x25 % G PU PR 0x26 & G PU PR 0x27 ' G PU PR 0x28 ( G PU PR 0x29 ) G PU PR 0x2a * G PU PR 0x2b + G PU PR 0x2c , G PU PR 0x2d - G PU PR 0x2e . G PU PR 0x2f / G PU PR 0x30 0 AN D G PR X 0x31 1 AN D G PR X 0x32 2 AN D G PR X 0x33 3 AN D G PR X 0x34 4 AN D G PR X 0x35 5 AN D G PR X : ****************************************************************************/ }Related Information