function
<cwctype>
iswalpha
Check if wide character is alphabetic
Checks whether c is an alphabetic letter wide character.
An alphabetic letter is a character for which iswupper or iswlower would return true, or another character explicitly considered alphabetic by the locale (in this case, the character cannot be iswcntrl, iswdigit, iswpunct or iswspace).
This function is the wide-character equivalent of isalpha (<cctype>): If c translates with wctob to a character for which isalpha is true, it is always considered alphabetic by this function too.
In C++, a locale-specific template version of this function (isalpha) exists in header <locale> for all character types.
Parameters
- c
- Wide character to be checked, casted to a wint_t, or WEOF.
wint_t is an integral type.
Return Value
A value different from zero (i.e., true) if indeed c is an alphabetic letter. Zero (i.e., false) otherwise.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
/* iswalpha example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
int i=0;
wchar_t str[] = L"C++";
while (str[i])
{
if (iswalpha(str[i])) wprintf (L"character %lc is alphabetic\n",str[i]);
else wprintf (L"character %lc is not alphabetic\n",str[i]);
i++;
}
return 0;
}
| |
Output:
character C is alphabetic
character + is not alphabetic
character + is not alphabetic
|
See also
- isalpha
- Check if character is alphabetic (function
)
- iswalnum
- Check if wide character is alphanumeric (function
)
- iswdigit
- Check if wide character is decimal digit (function
)
- isalpha (locale)
- Check if character is alphabetic using locale (function template
)