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