NAME
iswctype — test
character for a specified class
SYNOPSIS
#include
<wctype.h>
int iswctype(wint_t wc, wctype_t charclass);
DESCRIPTION
[CX] The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std 1003.1-2001 (“POSIX.1”) defers to the ISO C standard.
The iswctype () function
shall determine whether the wide-character code wc has the
character class charclass, returning true or false. The
iswctype () function is defined on WEOF and
wide-character codes corresponding to the valid character encodings in the
current locale. If the wc argument is not in the domain of
the function, the result is undefined. If the value of
charclass is invalid (that is, not obtained by a call to
wctype(3) or charclass is invalidated by
a subsequent call to setlocale(3) that has affected
category LC_CTYPE
) the result is unspecified.
RETURN VALUE
The iswctype () function shall return
non-zero (true) if and only if wc has the property
described by charclass. [CX] If
charclass is 0, iswctype () shall
return 0.
ERRORS
No errors are defined.
EXAMPLES
Testing for a Valid Character
#include <wctype.h>
...
int yes_or_no;
wint_t wc;
wctype_t valid_class;
...
if ((valid_class=wctype("vowel")) == (wctype_t)0)
/* Invalid character class. */
yes_or_no=iswctype(wc,valid_class);
APPLICATION USAGE
The twelve strings "alnum" ,
"alpha" ,
"blank" ,
"cntrl" ,
"digit" ,
"graph" ,
"lower" ,
"print" ,
"punct" ,
"space" ,
"upper" , and
"xdigit" are reserved for the standard
character classes. In the table below, the functions in the left column are
equivalent to the functions in the right column.
iswalnum(wc) iswctype(wc, wctype("alnum"))
iswalpha(wc) iswctype(wc, wctype("alpha"))
iswblank(wc) iswctype(wc, wctype("blank"))
iswcntrl(wc) iswctype(wc, wctype("cntrl"))
iswdigit(wc) iswctype(wc, wctype("digit"))
iswgraph(wc) iswctype(wc, wctype("graph"))
iswlower(wc) iswctype(wc, wctype("lower"))
iswprint(wc) iswctype(wc, wctype("print"))
iswpunct(wc) iswctype(wc, wctype("punct"))
iswspace(wc) iswctype(wc, wctype("space"))
iswupper(wc) iswctype(wc, wctype("upper"))
iswxdigit(wc) iswctype(wc, wctype("xdigit"))
RATIONALE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
iswalnum(3) , iswalpha(3) , iswcntrl(3) , iswdigit(3) , iswgraph(3) , iswlower(3) , iswprint(3) , iswpunct(3) , iswspace(3) , iswupper(3) , iswxdigit(3) , setlocale(3) , wctype(3) , the Base Definitions volume of IEEE Std 1003.1-2001 (“POSIX.1”), <wchar.h>, <wctype.h>
CHANGE HISTORY
First released as World-wide Portability Interfaces in Issue 4.
Issue 5
The following change has been made in this issue for alignment with ISO/IEC 9899/AMD1:1995 (“ISO C90, Amendment 1”) (E):
- The SYNOPSIS has been changed to indicate that this function and associated data types are now made visible by inclusion of the <wctype.h> header rather than <wchar.h>.
Issue 6
The behavior of n =0 is now described.
An example is added.
A new function, iswblank(3), is added to the list in the APPLICATION USAGE.
End of informative text. footer end