Home

cwctype

cwctype is a header in the C++ standard library that provides wide-character classification and mapping utilities, mirroring the C library’s ctype.h but designed for wide characters. It declares functions and types that operate on wide-character values (wchar_t and wint_t) to test character properties and perform case conversion, in a way that is intended to be compatible with the C wide-character facilities.

Key functions include iswalpha, iswupper, iswlower, iswdigit, iswxdigit, iswalnum, iswspace, iswpunct, iswgraph, iswprint, iswcntrl, and iswblank

Usage is analogous to the narrow-character <ctype.h> functions, but operates on wide characters. For example, towupper(L'a')

In practice, cwctype complements other wide-character facilities in the standard library, such as cwchar and <locale>

(where
supported).
There
is
also
iswctype(wint_t,
wctype_t)
to
test
whether
a
wide
character
has
a
specified
property
mask.
For
case
mapping,
towlower
and
towupper
convert
wide
characters
to
their
lowercase
or
uppercase
equivalents.
The
header
also
defines
the
types
wint_t,
wctype_t
and
wctrans_t,
which
are
used
with
these
utilities.
Additional
functionality
related
to
locale-aware
transformations
is
provided
via
wctrans
and
towctrans.
yields
L'A',
and
iswalpha(L'A')
indicates
whether
a
wide
character
is
alphabetic.
The
results
of
these
functions
are
locale-sensitive;
the
current
C
locale
influences
their
behavior
on
many
platforms.
Some
environments
offer
additional
locale-specific
variants
(often
with
a
_l
suffix)
to
select
a
particular
locale
explicitly.
support,
enabling
portable
wide-character
processing
in
C++
programs.
See
also:
ctype
(for
narrow
characters),
cwchar,
and
locale
facilities.