function
<cwctype>
iswalnum
Check if wide character is alphanumeric
Checks whether c is either an alphabetic letter (either uppercase or lowercase) or a decimal digit.
The result is true if either iswalpha or iswdigit would also return true for c.
This function is the wide-character equivalent of isalnum (<cctype>): If c translates with wctob to a character for which isalnum is true, it is always considered alphanumeric by this function too.
In C++, a locale-specific template version of this function (isalnum) 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 either a digit or a letter. Zero (i.e., false) otherwise.
Example
1 2 3 4 5 6 7 8 9 10 11 12
|
/* iswalnum example */
#include <stdio.h>
#include <wctype.h>
int main ()
{
int i;
wchar_t str[] = L"c3po...";
i=0;
while (iswalnum(str[i])) i++;
wprintf (L"The first %d characters are alphanumeric.\n",i);
return 0;
}
| |
Output:
The first 4 characters are alphanumeric.
|
See also
- isalnum
- Check if character is alphanumeric (function
)
- iswalpha
- Check if wide character is alphabetic (function
)
- iswdigit
- Check if wide character is decimal digit (function
)
- isalnum (locale)
- Check if character is alphanumeric using locale (function template
)