feat: (str) str_{up,down}case

This commit is contained in:
thetek 2023-02-15 09:46:51 +01:00
parent 261498b03f
commit 4048a4d2b9
2 changed files with 26 additions and 0 deletions

View File

@ -29,5 +29,7 @@ bool str_ends_with_len (const str_t *str, const char *find, size_t len); /* chec
char *str_find (const str_t *str, const char *find); /* find a substring in a str_t string as a pointer. */
ssize_t str_pos (const str_t *str, const char *find); /* find the index of a substring in a str_t string. */
bool str_is_blank (const str_t *str); /* check if a string only consists of whitespace characters. */
void str_downcase (str_t *str); /* transform all uppercase characters in a str_t string to lowercase */
void str_upcase (str_t *str); /* transform all lowercase characters in a str_t string to uppercase */
#endif // CUTILS_STR_H_

View File

@ -259,3 +259,27 @@ str_is_blank (const str_t *str)
{
return strisblank (str->str);
}
/**
* transform all uppercase characters in a str_t string to lowercase
* characters. this will modify the string data.
*
* @param str: the string to modify
*/
inline void
str_downcase (str_t *str)
{
strdowncase (str->str);
}
/**
* transform all lowercase characters in a str_t string to uppercase
* characters. this will modify the string data.
*
* @param str: the string to modify
*/
inline void
str_upcase (str_t *str)
{
strupcase (str->str);
}