LibC: add toupper, tolower in ctype.h

This commit is contained in:
Bananymous 2023-05-10 23:13:56 +03:00
parent 0adf24fcad
commit d922c5e1d0
2 changed files with 17 additions and 0 deletions

View File

@ -64,3 +64,17 @@ int isxdigit(int c)
{ {
return isdigit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F'); return isdigit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F');
} }
int toupper(int c)
{
if (!islower(c))
return c;
return 'A' + (c - 'a');
}
int tolower(int c)
{
if (!isupper(c))
return c;
return 'a' + (c - 'A');
}

View File

@ -18,4 +18,7 @@ int isspace(int);
int isupper(int); int isupper(int);
int isxdigit(int); int isxdigit(int);
int toupper(int);
int tolower(int);
__END_DECLS __END_DECLS