Name

isalnum - character classification routines

Library

libc.lib

Synopsis

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

Return values

The isalnum function returns zero if the character is not alphanumeric and returns non-zero if the character tests true.

Detailed description

The function isalnum returns non-zero if ’c’ is alphanumeric i.e. it belongs to class alnum(see defns for definition). In other words, it returns non-zero if the test for isalpha or isdigit is non-zero, irrespective of the program’s current locale. 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 alnum, irrespective of the locale they belong to.


Examples

#include<ctype.h> //isalnum()
#include<stdio.h> //printf()
void test_isalnum()
{
   int arr[]={’8’,0xe1,’5’,’Z’,0xfd};
   int i = 0;
   int size = 5;
   for( i=0; i<size; i++)
   {
      int ret = isalnum(arr[i]); //call to the API with chars in arr[]
      if( (!ret) != 0 )
      {
          printf("\n%c is not alphanumeric", arr[i]);
      }
      else
      {
          printf("\n%c is an alphanumeric ", arr[i]);
      }
   }
   printf("\n");
}


Output

a is an alphanumeric
á is an alphanumeric
5 is an alphanumeric
Z is an alphanumeric
ý is an alphanumeric


See also

isalpha, isdigit, iswalnum

Feedback

For additional information or queries on this page send feedback

© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top