Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
25
Task/String-case/Potion/string-case.potion
Normal file
25
Task/String-case/Potion/string-case.potion
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
lowercase = (str) :
|
||||
low = ("")
|
||||
str length times (i) :
|
||||
low append(if (65 <= str(i) ord and str(i) ord <= 90) :
|
||||
"abcdefghijklmnopqrstuvwxyz"(str(i) ord - 65)
|
||||
. else :
|
||||
str(i)
|
||||
.)
|
||||
.
|
||||
low join("")
|
||||
.
|
||||
uppercase = (str) :
|
||||
upp = ("")
|
||||
str length times (i) :
|
||||
upp append(if (97 <= str(i) ord and str(i) ord <= 122) :
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"(str(i) ord - 97)
|
||||
. else :
|
||||
str(i)
|
||||
.)
|
||||
.
|
||||
upp join("")
|
||||
.
|
||||
|
||||
lowercase("alphaBETA") print
|
||||
uppercase("alphaBETA") print
|
||||
Loading…
Add table
Add a link
Reference in a new issue