src: add str_toupper and str_tolower functions

Add auxiliar string case change functions.
master
Alejandro Sirgo Rica 2024-07-15 16:36:45 +02:00
parent 59ccaaebf6
commit df52acba04
2 changed files with 13 additions and 4 deletions

View File

@ -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++;
}
return str;
}
void str_tolower(char *str)
{
char *c = str;
while (*c) {
*c = tolower(*c);
c++;
}
}

View File

@ -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