std::iswalpha
From cppreference.com
Defined in header <cwctype>
|
||
int iswalpha( std::wint_t ch ); |
||
Checks if the given wide character is an alphabetic character, i.e. either an uppercase letter (ABCDEFGHIJKLMNOPQRSTUVWXYZ
), a lowercase letter (abcdefghijklmnopqrstuvwxyz
) or any alphabetic character specific to the current locale.
If the value of ch is neither representable as a wchar_t nor equal to the value of the macro WEOF, the behavior is undefined.
Contents |
[edit] Parameters
ch | - | wide character |
[edit] Return value
Non-zero value if the wide character is an alphabetic character, โ0โ otherwise.
[edit] Notes
ISO 30112 specifies which Unicode characters are include in POSIX alpha category.
[edit] Example
Run this code
#include <clocale> #include <cwctype> #include <iostream> int main() { wchar_t c = L'\u0b83'; // Tamil sign Visarga ('เฎ') std::cout << std::hex << std::showbase << std::boolalpha; std::cout << "in the default locale, iswalpha(" << (std::wint_t)c << ") = " << (bool)std::iswalpha(c) << '\n'; std::setlocale(LC_ALL, "en_US.utf8"); std::cout << "in Unicode locale, iswalpha(" << (std::wint_t)c << ") = " << (bool)std::iswalpha(c) << '\n'; }
Possible output:
in the default locale, iswalpha(0xb83) = false in Unicode locale, iswalpha(0xb83) = true
[edit] See also
checks if a character is classified as alphabetic by a locale (function template) | |
checks if a character is alphabetic (function) | |
C documentation for iswalpha
|
ASCII values | characters |
isalpha |
|||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
decimal | hexadecimal | octal | |||||||||||||
0โ8 | \x0 โ\x8
|
\0 โ\10
|
control codes (NUL , etc.)
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
9 | \x9
|
\11
|
tab (\t )
|
โ 0
|
0
|
โ 0
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
10โ13 | \xA โ\xD
|
\12 โ\15
|
whitespaces (\n , \v , \f , \r )
|
โ 0
|
0
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
14โ31 | \xE โ\x1F
|
\16 โ\37
|
control codes | โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
32 | \x20
|
\40
|
space | 0
|
โ 0
|
โ 0
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
33โ47 | \x21 โ\x2F
|
\41 โ\57
|
!"#$%&'()*+,-./
|
0
|
โ 0
|
0
|
0
|
โ 0
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
48โ57 | \x30 โ\x39
|
\60 โ\71
|
0123456789
|
0
|
โ 0
|
0
|
0
|
โ 0
|
0
|
โ 0
|
0
|
0
|
0
|
โ 0
|
โ 0
|
58โ64 | \x3A โ\x40
|
\72 โ\100
|
:;<=>?@
|
0
|
โ 0
|
0
|
0
|
โ 0
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
65โ70 | \x41 โ\x46
|
\101 โ\106
|
ABCDEF
|
0
|
โ 0
|
0
|
0
|
โ 0
|
0
|
โ 0
|
โ 0
|
โ 0
|
0
|
0
|
โ 0
|
71โ90 | \x47 โ\x5A
|
\107 โ\132
|
GHIJKLMNOP QRSTUVWXYZ
|
0
|
โ 0
|
0
|
0
|
โ 0
|
0
|
โ 0
|
โ 0
|
โ 0
|
0
|
0
|
0
|
91โ96 | \x5B โ\x60
|
\133 โ\140
|
[\]^_`
|
0
|
โ 0
|
0
|
0
|
โ 0
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
97โ102 | \x61 โ\x66
|
\141 โ\146
|
abcdef
|
0
|
โ 0
|
0
|
0
|
โ 0
|
0
|
โ 0
|
โ 0
|
0
|
โ 0
|
0
|
โ 0
|
103โ122 | \x67 โ\x7A
|
\147 โ\172
|
ghijklmnop qrstuvwxyz
|
0
|
โ 0
|
0
|
0
|
โ 0
|
0
|
โ 0
|
โ 0
|
0
|
โ 0
|
0
|
0
|
123โ126 | \x7B โ\x7E
|
\172 โ\176
|
{|}~
|
0
|
โ 0
|
0
|
0
|
โ 0
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
127 | \x7F
|
\177
|
backspace character (DEL )
|
โ 0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|