Character classification and manipulation


Detailed Description

The char family of macros check whether ch, which must have the value of an unsigned char, falls into a certain character class.

char_isalnum() checks for an alphanumeric character; it is equivalent to (char_isalpha(ch) || char_isdigit(ch)).

char_isalpha() checks for an alphabetic character; it is equivalent to (char_isupper(c) || char_islower(c)).

char_isascii() checks whether ch is a 7-bit unsigned char value that fits into the ASCII character set.

char_isblank() checks for a blank character; that is, a space or a tab.

char_iscntrl() checks for a control character.

char_isdigit() checks for a digit (0 through 9).

char_isgraph() checks for any printable character except space.

char_islower() checks for a lower-case character.

char_isprint() checks for any printable character including space.

char_ispunct() checks for any printable character which is not a space or an alphanumeric character.

char_isspace() checks for white-space characters. These are: space, form-feed (''), newline ('
'), carriage return (''), horizontal tab (''), and vertical tab ('').

char_isupper() checks for an uppercase letter.

char_isxdigit() checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F.

char_tolower() converts a character to lowercase if applicable.

char_toupper() converts a character to uppercase if applicable.


Defines

#define char_isascii(ch)   ((unsigned int)(ch) < 128u)
 check for an ASCII character
#define char_isblank(ch)   (ch == ' ' || ch == '\t')
 check for a blank character (space, horizontal tab)
#define char_iscntrl(ch)   ((unsigned int)(ch) < 32u || ch == 127)
 check for an ASCII control character
#define char_isdigit(ch)   ((unsigned int)(ch - '0') < 10u)
 check for a digit character (0-9)
#define char_isgraph(ch)   ((unsigned int)(ch - '!') < 94u)
 check for graphable characters (excluding space)
#define char_islower(ch)   ((unsigned int)(ch - 'a') < 26u)
 check for a lower-case character
#define char_isprint(ch)   ((unsigned int)(ch - ' ') < 95u)
 check for a printable character (including space)
#define char_isspace(ch)   ((unsigned int)(ch - '\t') < 5u || ch == ' ')
 check for a whitespace character (\t, \n, \v, \f, \r)
#define char_isupper(ch)   ((unsigned int)(ch - 'A') < 26u)
 check for an upper-case character
#define char_isxdigit(ch)
 check for a hexadecimal character
#define char_isalpha(ch)   (char_islower(ch) || char_isupper(ch))
 check for an upper- or lower-case character
#define char_isalnum(ch)   (char_isalpha(ch) || char_isdigit(ch))
 check for an upper-, lower-case or digit character
#define char_ispunct(ch)
 check for a punctuation character
#define char_tolower(ch)   do { if (char_isupper(ch)) ch += 32; } while(0)
 convert character to lower-case
#define char_toupper(ch)   do { if (char_islower(ch)) ch -= 32; } while(0)
 convert character to upper-case


Define Documentation

#define char_isascii ( ch   )     ((unsigned int)(ch) < 128u)

check for an ASCII character

Definition at line 67 of file char.h.

Referenced by str_check().

#define char_isblank ( ch   )     (ch == ' ' || ch == '\t')

check for a blank character (space, horizontal tab)

Definition at line 70 of file char.h.

Referenced by str_check().

#define char_iscntrl ( ch   )     ((unsigned int)(ch) < 32u || ch == 127)

check for an ASCII control character

Definition at line 73 of file char.h.

Referenced by str_check().

#define char_isdigit ( ch   )     ((unsigned int)(ch - '0') < 10u)

check for a digit character (0-9)

Definition at line 76 of file char.h.

Referenced by str_check().

#define char_isgraph ( ch   )     ((unsigned int)(ch - '!') < 94u)

check for graphable characters (excluding space)

Definition at line 79 of file char.h.

Referenced by str_check().

#define char_islower ( ch   )     ((unsigned int)(ch - 'a') < 26u)

check for a lower-case character

Definition at line 82 of file char.h.

Referenced by str_check().

#define char_isprint ( ch   )     ((unsigned int)(ch - ' ') < 95u)

check for a printable character (including space)

Definition at line 85 of file char.h.

Referenced by str_check().

#define char_isspace ( ch   )     ((unsigned int)(ch - '\t') < 5u || ch == ' ')

check for a whitespace character (\t, \n, \v, \f, \r)

Definition at line 88 of file char.h.

Referenced by _lucid_vsscanf(), str_check(), and str_toumax().

#define char_isupper ( ch   )     ((unsigned int)(ch - 'A') < 26u)

check for an upper-case character

Definition at line 91 of file char.h.

Referenced by str_check().

#define char_isxdigit ( ch   ) 

Value:

(char_isdigit(ch) || \
                          (unsigned int)(ch - 'a') < 6u || \
                          (unsigned int)(ch - 'A') < 6u)
check for a hexadecimal character

Definition at line 94 of file char.h.

Referenced by str_check().

#define char_isalpha ( ch   )     (char_islower(ch) || char_isupper(ch))

check for an upper- or lower-case character

Definition at line 100 of file char.h.

Referenced by str_check().

#define char_isalnum ( ch   )     (char_isalpha(ch) || char_isdigit(ch))

check for an upper-, lower-case or digit character

Definition at line 103 of file char.h.

Referenced by str_check().

#define char_ispunct ( ch   ) 

Value:

(char_isprint(ch) && \
                         !char_isalnum(ch) && \
                         !char_isspace(ch))
check for a punctuation character

Definition at line 106 of file char.h.

Referenced by str_check().

#define char_tolower ( ch   )     do { if (char_isupper(ch)) ch += 32; } while(0)

convert character to lower-case

Definition at line 112 of file char.h.

Referenced by str_tolower().

#define char_toupper ( ch   )     do { if (char_islower(ch)) ch -= 32; } while(0)

convert character to upper-case

Definition at line 115 of file char.h.

Referenced by str_toupper().


Generated on Tue Jun 19 20:38:45 2007 for lucid by  doxygen 1.5.2