ASCII character checks and conversion.
Handles checking if a caracter is a certain type. Also handles converting characters to other representations. Such as to lowercase, and to uppercase.
◆ M_chr_predicate_func
typedef M_bool(* M_chr_predicate_func) (char c) |
◆ M_chr_map_func
typedef char(* M_chr_map_func) (char) |
◆ M_chr_isalnum()
M_bool M_chr_isalnum |
( |
char |
c | ) |
|
Checks for an alphanumeric character.
Equivalent regular expression: [A-Za-z0-9]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isalnumsp()
M_bool M_chr_isalnumsp |
( |
char |
c | ) |
|
Checks for an alphanumeric character, spaces allowed.
Equivalent regular expression: [A-Za-z0-9 ]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isalpha()
M_bool M_chr_isalpha |
( |
char |
c | ) |
|
Checks for an alphabetic character.
Equivalent regular expression: [A-Za-z]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isalphasp()
M_bool M_chr_isalphasp |
( |
char |
c | ) |
|
Checks for an alphabetic character, spaces allowed.
Equivalent regular expression: [A-Za-z ]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isascii()
M_bool M_chr_isascii |
( |
char |
c | ) |
|
Checks for 7-bit ASCII character.
Equivalent regular expression: [\x00-\x7f]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isblank()
M_bool M_chr_isblank |
( |
char |
c | ) |
|
Checks for a blank character.
Equivalent regular expression: [ \t]
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_iscntrl()
M_bool M_chr_iscntrl |
( |
char |
c | ) |
|
Checks for a control character.
Equivalent regular expression: [ \t]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isdigit()
M_bool M_chr_isdigit |
( |
char |
c | ) |
|
Checks for a digit zero through nine.
Equivalent regular expression: [0-9]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isdec()
M_bool M_chr_isdec |
( |
char |
c | ) |
|
Checks for a digit zero through nine or a period.
Equivalent regular expression: [0-9.]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isgraph()
M_bool M_chr_isgraph |
( |
char |
c | ) |
|
Checks for any printable character except space.
Equivalent regular expression: [!-~]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_islower()
M_bool M_chr_islower |
( |
char |
c | ) |
|
Checks for a lower-case character [a-z].
Equivalent regular expression: [a-z]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isupper()
M_bool M_chr_isupper |
( |
char |
c | ) |
|
Checks for an uppercase letter.
Equivalent regular expression: [A-Z]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isprint()
M_bool M_chr_isprint |
( |
char |
c | ) |
|
Checks for any printable character including space.
Equivalent regular expression: [ -~]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_ispunct()
M_bool M_chr_ispunct |
( |
char |
c | ) |
|
Checks for any printable character which is not a space or an alphanumeric character.
Equivalent regular expression: [!-/:-@[-`{-~]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_isspace()
M_bool M_chr_isspace |
( |
char |
c | ) |
|
Checks for white-space characters.
Equivalent regular expression: [\f\n\r\t\v]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_ishex()
M_bool M_chr_ishex |
( |
char |
c | ) |
|
Checks for a hexadecimal digits.
Equivalent regular expression: [0-9a-fA-F]
.
- Parameters
-
[in] | c | The character to check. |
- Returns
- True if in character class or false if not.
◆ M_chr_tolower()
char M_chr_tolower |
( |
char |
c | ) |
|
Convert character to lower case, if possible.
- Parameters
-
[in] | c | The character to convert. |
- Returns
- c if not uppercase, otherwise the lowercase equivalent of c.
◆ M_chr_toupper()
char M_chr_toupper |
( |
char |
c | ) |
|
Convert character to upper case, if possible
- Parameters
-
[in] | c | The character to convert. |
- Returns
- c if not lowercase, otherwise the uppercase equivalent of c
◆ M_chr_digit()
int M_chr_digit |
( |
char |
c | ) |
|
Convert a base-10 digit represented as a character to its corresponding integer representation.
- Parameters
-
[in] | c | The decimal character to convert. |
- Returns
- 0-9 on valid input, -1 if c is not a digit.
◆ M_chr_xdigit()
int M_chr_xdigit |
( |
char |
c | ) |
|
Convert a base-16 (hexadecimal) digit represented as a character to its corresponding integer representation.
- Parameters
-
[in] | c | The hexadecimal character to convert. |
- Returns
- 0-9 on valid input, -1 if c is not a digit.