feat: (str) str_{up,down}case
This commit is contained in:
parent
261498b03f
commit
4048a4d2b9
|
@ -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_
|
||||
|
|
24
lib/str.c
24
lib/str.c
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue