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
symbol before you include the ctype.h header, then the functions will be inlined.
Function Documentation
Tests if a character is an alphanumeric character.
- Parameters:
-
- Returns:
- 0 if the character is not alphanumeric, non-0 otherwise
Tests if a character is an alphabetic character.
- Parameters:
-
- Returns:
- 0 if the character is not alphabetic, non-0 otherwise
Tests if a character is an alphabetic character.
- Parameters:
-
- Returns:
- 0 if the character is not alphabetic, non-0 otherwise
Tests if a character is tabulator or space character.
- Parameters:
-
- Returns:
- 0 if the character is neither tabulator nor space, non-0 otherwise
Tests if a character is an ASCII control character.
- Parameters:
-
- Returns:
- 0 if the character is not ASCII control, non-0 otherwise
Tests if a character is a decimal digit character.
- Parameters:
-
- Returns:
- 0 if the character is not a decimal digit, non-0 otherwise
Tests if a character is a decimal digit character.
- Parameters:
-
- Returns:
- 0 if the character is not a decimal digit, non-0 otherwise
Tests if a character is a lowercase letter character.
- Parameters:
-
- Returns:
- 0 if the character is not a lowercase letter, non-0 otherwise
Tests if a character is a printable character.
- Parameters:
-
- Returns:
- 0 if the character is not a printable, non-0 if it is
Tests if a character is a punctuation character.
- Parameters:
-
- Returns:
- 0 if the character is not punctuation, non-0 otherwise
Tests if a character is a whitespace character.
- Parameters:
-
- Returns:
- 0 if the character is not whitespace, non-0 otherwise
Tests if a character is an uppercase letter.
- Parameters:
-
- Returns:
- 0 if the character is not an upperces letter, non-0 otherwise
Tests if a character is a hexadecimal digit.
- Parameters:
-
- Returns:
- 0 if the character is not a hex digit, non-0 otherwise
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
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