1ISWCTYPE(P) POSIX Programmer's Manual ISWCTYPE(P)
2
3
4
6 iswctype - test character for a specified class
7
9 #include <wctype.h>
10
11 int iswctype(wint_t wc, wctype_t charclass);
12
13
15 The iswctype() function shall determine whether the wide-character code
16 wc has the character class charclass, returning true or false. The
17 iswctype() function is defined on WEOF and wide-character codes corre‐
18 sponding to the valid character encodings in the current locale. If the
19 wc argument is not in the domain of the function, the result is unde‐
20 fined. If the value of charclass is invalid (that is, not obtained by a
21 call to wctype() or charclass is invalidated by a subsequent call to
22 setlocale() that has affected category LC_CTYPE ) the result is unspec‐
23 ified.
24
26 The iswctype() function shall return non-zero (true) if and only if wc
27 has the property described by charclass. If charclass is 0, iswc‐
28 type() shall return 0.
29
31 No errors are defined.
32
33 The following sections are informative.
34
36 Testing for a Valid Character
37 #include <wctype.h>
38 ...
39 int yes_or_no;
40 wint_t wc;
41 wctype_t valid_class;
42 ...
43 if ((valid_class=wctype("vowel")) == (wctype_t)0)
44 /* Invalid character class. */
45 yes_or_no=iswctype(wc,valid_class);
46
48 The twelve strings "alnum" , "alpha" , "blank" , "cntrl" , "digit" ,
49 "graph" , "lower" , "print" , "punct" , "space" , "upper" , and
50 "xdigit" are reserved for the standard character classes. In the table
51 below, the functions in the left column are equivalent to the functions
52 in the right column.
53
54
55 iswalnum(wc) iswctype(wc, wctype("alnum"))
56 iswalpha(wc) iswctype(wc, wctype("alpha"))
57 iswblank(wc) iswctype(wc, wctype("blank"))
58 iswcntrl(wc) iswctype(wc, wctype("cntrl"))
59 iswdigit(wc) iswctype(wc, wctype("digit"))
60 iswgraph(wc) iswctype(wc, wctype("graph"))
61 iswlower(wc) iswctype(wc, wctype("lower"))
62 iswprint(wc) iswctype(wc, wctype("print"))
63 iswpunct(wc) iswctype(wc, wctype("punct"))
64 iswspace(wc) iswctype(wc, wctype("space"))
65 iswupper(wc) iswctype(wc, wctype("upper"))
66 iswxdigit(wc) iswctype(wc, wctype("xdigit"))
67
69 None.
70
72 None.
73
75 iswalnum() , iswalpha() , iswcntrl() , iswdigit() , iswgraph() ,
76 iswlower() , iswprint() , iswpunct() , iswspace() , iswupper() ,
77 iswxdigit() , setlocale() , wctype() , the Base Definitions volume of
78 IEEE Std 1003.1-2001, <wchar.h>, <wctype.h>
79
81 Portions of this text are reprinted and reproduced in electronic form
82 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
83 -- Portable Operating System Interface (POSIX), The Open Group Base
84 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
85 Electrical and Electronics Engineers, Inc and The Open Group. In the
86 event of any discrepancy between this version and the original IEEE and
87 The Open Group Standard, the original IEEE and The Open Group Standard
88 is the referee document. The original Standard can be obtained online
89 at http://www.opengroup.org/unix/online.html .
90
91
92
93IEEE/The Open Group 2003 ISWCTYPE(P)