Character classes
[C library]

These functions work on ASCII characters and can classify them as well as change between upper and lower case letters. More...

Functions

int isalnum (int c)
 Tests if a character is an alphanumeric character.
int isalpha (int c)
 Tests if a character is an alphabetic character.
int isascii (int c)
 Tests if a character is an alphabetic character.
int isblank (int c)
 Tests if a character is tabulator or space character.
int iscntrl (int c)
 Tests if a character is an ASCII control character.
int isdigit (int c)
 Tests if a character is a decimal digit character.
int isgraph (int c)
 Tests if a character is a decimal digit character.
int islower (int c)
 Tests if a character is a lowercase letter character.
int isprint (int c)
 Tests if a character is a printable character.
int ispunct (int c)
 Tests if a character is a punctuation character.
int isspace (int c)
 Tests if a character is a whitespace character.
int isupper (int c)
 Tests if a character is an uppercase letter.
int isxdigit (int c)
 Tests if a character is a hexadecimal digit.
int tolower (int c)
 Change characters to lowercase.
int toupper (int c)
 Change characters to uppercase.

Detailed Description

These functions work on ASCII characters and can classify them as well as change between upper and lower case letters.



To use these functions you have to include ctype.h.

The character classification is based on a class table, so these functions do a single table lookup. Such simple functions are good candidates for inlining. Therefore, if you define the

#define BLC_CTYPE_INLINE

symbol before you include the ctype.h header, then the functions will be inlined.


Function Documentation

int isalnum ( int  c  ) 

Tests if a character is an alphanumeric character.

Parameters:
c The character to test
Returns:
0 if the character is not alphanumeric, non-0 otherwise
int isalpha ( int  c  ) 

Tests if a character is an alphabetic character.

Parameters:
c The character to test
Returns:
0 if the character is not alphabetic, non-0 otherwise
int isascii ( int  c  ) 

Tests if a character is an alphabetic character.

Parameters:
c The character to test
Returns:
0 if the character is not alphabetic, non-0 otherwise
int isblank ( int  c  ) 

Tests if a character is tabulator or space character.

Parameters:
c The character to test
Returns:
0 if the character is neither tabulator nor space, non-0 otherwise
int iscntrl ( int  c  ) 

Tests if a character is an ASCII control character.

Parameters:
c The character to test
Returns:
0 if the character is not ASCII control, non-0 otherwise
int isdigit ( int  c  ) 

Tests if a character is a decimal digit character.

Parameters:
c The character to test
Returns:
0 if the character is not a decimal digit, non-0 otherwise
int isgraph ( int  c  ) 

Tests if a character is a decimal digit character.

Parameters:
c The character to test
Returns:
0 if the character is not a decimal digit, non-0 otherwise
int islower ( int  c  ) 

Tests if a character is a lowercase letter character.

Parameters:
c The character to test
Returns:
0 if the character is not a lowercase letter, non-0 otherwise
int isprint ( int  c  ) 

Tests if a character is a printable character.

Parameters:
c The character to test
Returns:
0 if the character is not a printable, non-0 if it is
int ispunct ( int  c  ) 

Tests if a character is a punctuation character.

Parameters:
c The character to test
Returns:
0 if the character is not punctuation, non-0 otherwise
int isspace ( int  c  ) 

Tests if a character is a whitespace character.

Parameters:
c The character to test
Returns:
0 if the character is not whitespace, non-0 otherwise
int isupper ( int  c  ) 

Tests if a character is an uppercase letter.

Parameters:
c The character to test
Returns:
0 if the character is not an upperces letter, non-0 otherwise
int isxdigit ( int  c  ) 

Tests if a character is a hexadecimal digit.

Parameters:
c The character to test
Returns:
0 if the character is not a hex digit, non-0 otherwise
int tolower ( int  c  ) 

Change characters to lowercase.

This function changes uppercase letters to lowercase. The affected range is 'A' to 'Z'. All other values are returned verbatim.

Parameters:
c The character to convert to lowercase
Returns:
The converted character
int toupper ( int  c  ) 

Change characters to uppercase.

This function changes lowercase letters to uppercase. The affected range is 'a' to 'z'. All other values are returned verbatim.

Parameters:
c The character to convert to uppercase
Returns:
The converted character
Generated on Fri Aug 13 12:02:25 2010 by  doxygen 1.6.3