#include <ctype.h>
|
|
int
isalpha (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 alpha,
irrespective of the locale they belong to.
#include<ctype.h> //isalpha()
#include<stdio.h> //printf()
void test_isalpha()
{
int arr[]={’a’,0xe1,’5’,’Z’,0xfd};
int i = 0;
int size = 5;
for( i=0; i<size; i++)
{
int ret = isalpha(arr[i]); //call to the API with chars in arr[]
if( (!ret) != 0 )
{
printf("\n%c is not an alphabet", arr[i]);
}
else
{
printf("\n%c is an alphabet", arr[i]);
}
}
printf("\n");
}
Output
a is an alphabet
á is an alphabet
5 is not an alphabet
Z is an alphabet
ý is an alphabet
|
© 2005-2007 Nokia |