added some utility functions + fixed error in ostrAppendview

This commit is contained in:
snarmph 2021-10-31 10:25:46 +00:00
parent aa39e2563d
commit be71719f73
7 changed files with 47 additions and 18 deletions

12
str.c
View file

@ -263,6 +263,18 @@ str_t strToLower(str_t ctx) {
return str;
}
void strUpper(str_t *ctx) {
for(size_t i = 0; i < ctx->len; ++i) {
ctx->buf[i] = (char)toupper(ctx->buf[i]);
}
}
str_t strToUpper(str_t ctx) {
str_t str = strDup(ctx);
strUpper(&str);
return str;
}
// == STRVIEW_T ====================================================
strview_t strvInit(const char *cstr) {