Header File
ctype.h, mbstring.h
Category
Classification Routines
Prototype
int isalnum(int c);
int __iscsym(int c);
int iswalnum(wint_t c);
int _ismbcalnum(unsigned int c);
Description
Tests for an alphanumeric character.
isalnum is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a letter (A to Z or a to z) or a digit (0 to 9).
You can make this macro available as a function by undefining (#undef) it.
Return Value
It is a predicate returning nonzero for true and 0 for false.
isalnum returns nonzero if c is a letter or a digit.
__iscsym returns nonzero if c is a letter, underscore, or digit.
iswalnum returns nonzero if iswalpha or iswdigit return true for c.
_ismbcalnum returns true if and only if the argument c is a single-byte ASCII English letter.
Example
#include <stdio.h> #include <ctype.h> int main(void) { char c = 'C'; if (isalnum(c)) printf("%c is alphanumeric\n",c); else printf("%c is not alphanumeric\n",c); return 0; }
Portability
|
POSIX |
Win32 |
ANSI C |
ANSI C++ |
isalnum |
+ |
+ |
+ |
+ |
__iscsym |
|
+ |
|
|
_ismbcalnum |
|
+ |
|
|
iswalnum |
|
+ |
+ |
+ |
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|