mirror of https://git.48k.eu/ogserver
src: add str_toupper and str_tolower functions
Add auxiliar string case change functions.master
parent
59ccaaebf6
commit
df52acba04
14
src/utils.c
14
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++;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void str_tolower(char *str)
|
||||
{
|
||||
char *c = str;
|
||||
|
||||
while (*c) {
|
||||
*c = tolower(*c);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue