ISWCTYPE(3POSIX)
π ISWCTYPE π
okay so welcome to the POSIX Programmer's Manual, bestie, this is page ISWCTYPE(3POSIX) and we're about to get so cozy with wide characters. grab a strawberry π, we're doing this.
PROLOG πΈ
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
ngl bestie that's a whole lot of "it depends" for a first paragraph but okay, we respect the honesty π
β¨ NAME β¨
iswctype, iswctype_l β test character for a specified class
π¦ SYNOPSIS π¦
#include <wctype.h>
int iswctype(wint_t wc, wctype_t charclass);
int iswctype_l(wint_t wc, wctype_t charclass,
locale_t locale);
π DESCRIPTION π
So for iswctype(): 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 β and this volume of POSIX.1-2017 defers to the ISO C standard, periodt.
The iswctype() and iswctype_l() functions shall determine whether the wide-character code wc has the character class charclass, returning true or false. It's giving "vibe check but for characters" and honestly? iconic.
The iswctype() and iswctype_l() functions are defined on WEOF and wide-character codes corresponding to the valid character encodings in the current locale, or in the locale represented by locale, respectively.
lowkey important: if thewcargument is not in the domain of the function, the result is undefined. and if the value ofcharclassis invalid β that is, not obtained by a call towctype()orcharclassis invalidated by a subsequent call tosetlocale()that has affected categoryLC_CTYPEβ the result is unspecified. no cap, don't do it.
The behavior is undefined if the locale argument to iswctype_l() is the special locale object LC_GLOBAL_LOCALE or is not a valid locale object handle. so like... pass a real one, bestie π«Ά
π RETURN VALUE π
The iswctype() and iswctype_l() functions shall return non-zero (true) if and only if wc has the property described by charclass. If charclass is (wctype_t)0, these functions shall return 0.
translation: true when it matches, false when it doesn't, and zero-in-zero-out when charclass is (wctype_t)0. slay π
π ERRORS π
No errors are defined.
The following sections are informative.
π 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);
not the "vowel" class being custom btw β the standard ones are listed right below, iykyk β¨
π§ 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. the way every single one of them is just a glow-up of the other... obsessed π₯
iswalnum(wc) iswctype(wc, wctype("alnum"))
iswalnum_l(wc, locale) iswctype_l(wc, wctype("alnum"), locale)
iswalpha(wc) iswctype(wc, wctype("alpha"))
iswalpha_l(wc, locale) iswctype_l(wc, wctype("alpha"), locale)
iswblank(wc) iswctype(wc, wctype("blank"))
iswblank_l(wc, locale) iswctype_l(wc, wctype("blank"), locale)
iswcntrl(wc) iswctype(wc, wctype("cntrl"))
iswcntrl_l(wc, locale) iswctype_l(wc, wctype("cntrl"), locale)
iswdigit(wc) iswctype(wc, wctype("digit"))
iswdigit_l(wc, locale) iswctype_l(wc, wctype("digit"), locale)
iswgraph(wc) iswctype(wc, wctype("graph"))
iswgraph_l(wc, locale) iswctype_l(wc, wctype("graph"), locale)
iswlower(wc) iswctype(wc, wctype("lower"))
iswlower_l(wc, locale) iswctype_l(wc, wctype("lower"), locale)
iswprint(wc) iswctype(wc, wctype("print"))
iswprint_l(wc, locale) iswctype_l(wc, wctype("print"), locale)
iswpunct(wc) iswctype(wc, wctype("punct"))
iswpunct_l(wc, locale) iswctype_l(wc, wctype("punct"), locale)
iswspace(wc) iswctype(wc, wctype("space"))
iswspace_l(wc, locale) iswctype_l(wc, wctype("space"), locale)
iswupper(wc) iswctype(wc, wctype("upper"))
iswupper_l(wc, locale) iswctype_l(wc, wctype("upper"), locale)
iswxdigit(wc) iswctype(wc, wctype("xdigit"))
iswxdigit_l(wc, locale) iswctype_l(wc, wctype("xdigit"), locale)
π RATIONALE π
None.
literally the shortest section ever and honestly? queen behavior, no filler π
β FUTURE DIRECTIONS β
None.
π₯ SEE ALSO π₯
iswalnum(), iswalpha(), iswcntrl(), iswdigit(), iswgraph(), iswlower(), iswprint(), iswpunct(), iswspace(), iswupper(), iswxdigit(), setlocale(), uselocale(), wctype()
The Base Definitions volume of POSIX.1-2017, <locale.h>, <wctype.h>
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! π«Ά this one came from IEEE/The Open Group, dated 2017, and the manual name on the tin is ISWCTYPE(3POSIX). thanks for reading all the way to the bottom, you're literally the main character πβ¨ππ¦πΈπ
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms