diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-07-15 16:36:45 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-07-15 16:36:45 +0200 |
commit | df52acba04e85191b0fc7f10b7853fe17fb25260 (patch) | |
tree | ff8228b009dd7701a95d8fa1c2db4e7d52b51c40 /src | |
parent | 59ccaaebf616bc0be96af3b9b8c0be6828113edc (diff) |
src: add str_toupper and str_tolower functions
Add auxiliar string case change functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils.c | 12 | ||||
-rw-r--r-- | src/utils.h | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/utils.c b/src/utils.c index ced6470..d49a9ac 100644 --- a/src/utils.c +++ b/src/utils.c @@ -10,7 +10,7 @@ #include <ctype.h> #include "utils.h" -const char *str_toupper(char *str) +void str_toupper(char *str) { char *c = str; @@ -18,6 +18,14 @@ const char *str_toupper(char *str) *c = toupper(*c); c++; } +} + +void str_tolower(char *str) +{ + char *c = str; - return str; + while (*c) { + *c = tolower(*c); + c++; + } } diff --git a/src/utils.h b/src/utils.h index e32d006..45ecf23 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,6 +1,7 @@ #ifndef _OG_UTILS_H #define _OG_UTILS_H -const char *str_toupper(char *str); +void str_toupper(char *str); +void str_tolower(char *str); #endif |