create to_lower and to_upper functions

This commit is contained in:
Rheidner 2021-04-28 18:23:13 -03:00
parent 332b88d679
commit 65440277e6
4 changed files with 14 additions and 0 deletions

5
base/Char/to_lower.kind Normal file
View File

@ -0,0 +1,5 @@
Char.to_lower(char: Char): Char
if Bool.and(U16.gte(char, 'A'), U16.lte(char, 'Z')) then
U16.add(char, 32#16)
else
char

5
base/Char/to_upper.kind Normal file
View File

@ -0,0 +1,5 @@
Char.to_upper(char: Char): Char
if Bool.and(U16.gte(char, 'a'), U16.lte(char, 'z')) then
U16.sub(char, 32#16)
else
char

View File

@ -0,0 +1,2 @@
String.to_lower(str: String): String
String.map(Char.to_lower, str)

View File

@ -0,0 +1,2 @@
String.to_upper(str: String): String
String.map(Char.to_upper, str)