Name

isspace - character classification routines

Library

libc.lib

Synopsis

  #include <ctype.h>
  int isspace (int c);

Return values

The isspace function returns non-zero if ’c’ is space character and zero otherwise.

Detailed description

The isspace function tests if ’c’ is from among white-space characters i.e. it belongs to class space(see defns for definition). This includes the following standard characters:

SPACE

FORM-FEED

NEWLINE

CARRIAGE-RETURN

TAB

VERTICAL-TAB

For single character representations, the value of the argument is representable as an unsigned char or the value of EOF.

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.


Examples

#include<ctype.h> //isspace()
#include<stdio.h> //printf()
int test_isspace()
{
   int arr[]={’\n’,’0’,’w’,’R’,0x3000,’ ’};
   int i = 0;
   int size = 5;
   for( i=0; i<size; i++)
   {
      int ret = isspace(arr[i]); //call to the API with chars in arr[]
      if( (!ret) != 0 )
      {
         printf("\n%c is not space char ", arr[i]);
      }
      else
      {
         printf("\n%c is space char", arr[i]);
      }
   }
printf("\n");
}

         

Output

 is space char
0 is not space char
w is not space char
R is not space char
   is space char

         

See also

iswspace

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top