[utils] string_is_lower/string_is_upper method
This commit is contained in:
@@ -76,10 +76,24 @@ void string_upper(char *s) {
|
|||||||
for (; *s; ++s) *s = toupper(*s);
|
for (; *s; ++s) *s = toupper(*s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool string_is_upper(char *s) {
|
||||||
|
for (; *s; ++s) {
|
||||||
|
if (*s != toupper(*s)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void string_lower(char *s) {
|
void string_lower(char *s) {
|
||||||
for (; *s; ++s) *s = tolower(*s);
|
for (; *s; ++s) *s = tolower(*s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool string_is_lower(char *s) {
|
||||||
|
for (; *s; ++s) {
|
||||||
|
if (*s != tolower(*s)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
uint string_translate(char *str, size_t len, char *word_chars, char *word_repls, size_t trans_len) {
|
uint string_translate(char *str, size_t len, char *word_chars, char *word_repls, size_t trans_len) {
|
||||||
uint num_replacements = 0;
|
uint num_replacements = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ int string_compare_len_case_insensitive(const char *str1, const char *str2, size
|
|||||||
size_t string_common_prefix(const char *str1, const char *str2);
|
size_t string_common_prefix(const char *str1, const char *str2);
|
||||||
size_t string_common_suffix(const char *str1, const char *str2);
|
size_t string_common_suffix(const char *str1, const char *str2);
|
||||||
|
|
||||||
void string_lower(char *str);
|
bool string_is_lower(char *s);
|
||||||
void string_upper(char *str);
|
void string_lower(char *s);
|
||||||
|
bool string_is_upper(char *s);
|
||||||
|
void string_upper(char *s);
|
||||||
|
|
||||||
bool string_starts_with(const char *str, const char *start);
|
bool string_starts_with(const char *str, const char *start);
|
||||||
bool string_ends_with(const char *str, const char *ending);
|
bool string_ends_with(const char *str, const char *ending);
|
||||||
|
|||||||
Reference in New Issue
Block a user