#include <ctype.h>
|
|
int
ispunct (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 punct, irrespective of the locale they belong to.
#include<ctype.h> //ispunct()
#include<stdio.h> //printf()
int test_ispunct()
{
int arr[]={0x3003,’3’,0x301C,’*’, ’+’};
int i = 0;
int size = 5;
for( i=0; i<size; i++)
{
int ret = ispunct(arr[i]); //call to the API with chars in arr[]
if( (!ret) != 0 )
{
printf("\n0x%x is not a punc char ", arr[i]);
}
else
{
printf("\n0x%x is a punc char", arr[i]);
}
}
printf("\n");
return 0;
}
Output
0x3003 is a punc char
0x33 is not a punc char
0x301c is a punc char
0x2a is a punc char
0x2b is a punc char
|
© 2005-2007 Nokia |