#include <ctype.h>
|
|
int
isalnum (int c); |
The functionality of this API is independent of the program’s current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class alnum, irrespective of the locale they belong to.
#include<ctype.h> //isalnum()
#include<stdio.h> //printf()
void test_isalnum()
{
int arr[]={’8’,0xe1,’5’,’Z’,0xfd};
int i = 0;
int size = 5;
for( i=0; i<size; i++)
{
int ret = isalnum(arr[i]); //call to the API with chars in arr[]
if( (!ret) != 0 )
{
printf("\n%c is not alphanumeric", arr[i]);
}
else
{
printf("\n%c is an alphanumeric ", arr[i]);
}
}
printf("\n");
}
Output
a is an alphanumeric
á is an alphanumeric
5 is an alphanumeric
Z is an alphanumeric
ý is an alphanumeric
|
© 2005-2007 Nokia |