feature (utils): implemented function to check if a char is a special character

This commit is contained in:
antifallobst 2023-05-19 01:50:55 +02:00
parent abf22ba917
commit c60e8f9564
2 changed files with 11 additions and 0 deletions

View File

@ -52,6 +52,7 @@ void string_bool_to_alpha (string_t string, bool value);
bool string_is_char_text (char chr);
bool string_is_char_number (char chr);
bool string_is_char_special (char chr);
bool string_is_char_alpha (char chr);
bool string_is_char_uppercase (char chr);
bool string_is_char_lowercase (char chr);

View File

@ -433,6 +433,16 @@ bool string_is_char_number(char chr) {
return false;
}
bool string_is_char_special(char chr) {
if ((chr >= '!' && chr <= '/') ||
(chr >= ':' && chr <= '@') ||
(chr >= '^' && chr <= '`') ||
(chr >= '{' && chr <= '~')) {
return true;
}
return false;
}
bool string_is_char_alpha(char chr) {
if (string_is_char_uppercase(chr) || string_is_char_lowercase(chr) || string_is_char_number(chr)) {
return true;