#include <wctype.h>
|
|
int
iswdigit (wint_t wch); |
The iswdigit() function tests whether ’wch’ is a wide digit. 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 digit(see defns for definition), irrespective of the locale they belong to.
For example, the digits 0 to 9 fall under class digit.
#include<wctype.h> //iswdigit()
#include<stdio.h> //printf()
void test_iswdigit()
{
int arr[]={’8’,0xe1,’5’,’Z’,0xfd,
0xFF12,0xFF19,0xFF71,0x03A3};
int i = 0;
int size = 9;
for( i=0; i<size; i++)
{
int ret = iswdigit(arr[i]); //call to the API with chars in arr[]
if( (!ret) != 0 )
{
printf("\n%lc is not a wide digit", arr[i]);
}
else
{
printf("\n%lc is a wide digit", arr[i]);
}
}
printf("\n");
}
Output
8 is wide digit
«¡ is not wide digit
5 is wide digit
Z is not wide digit
«ò is not wide digit
£² is wide digit
£¹ is wide digit
± is not wide digit
¦² is not wide digit
|
© 2005-2007 Nokia |