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
|
GHIJKLMNOPQRSTUVWXYZ
|
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
|
ghijklmnopqrstuvwxyz
|
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
|