#include <wctype.h>
|
|
int
iswspace (wint_t wch); |
The iswspace() function tests whether ’wch’ is a wide-character that introduces white-space.
The following are such characters in the POSIX locale:
SPACE
FORM-FEED
NEWLINE
CARRIAGE-RETURN
TAB
VERTICAL-TAB
The result of this function is undefined unless the argument is WEOF or a valid wchar_t value.
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 space, irrespective of the locale they belong to.
#include<wctype.h> //iswspace()
#include<stdio.h> //printf()
int test_iswspace()
{
int arr[]={’\n’,’0’,’w’,’R’,0x3000,’ ’, 0x000A, 0x002};
int i = 0;
int size = 8;
for( i=0; i<size; i++)
{
int ret = iswspace(arr[i]); //call to the API with chars in arr[]
if( (!ret) != 0 )
{
printf("\n%lc is not wide space ", arr[i]);
}
else
{
printf("\n%lc is wide space", arr[i]);
}
}
printf("\n");
}
Output
is wide space
0 is not wide space
w is not wide space
R is not wide space
¡¡ is wide space
is wide space
is wide space
is wide space
|
© 2005-2007 Nokia |