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
29
Task/String-case/Lingo/string-case-1.lingo
Normal file
29
Task/String-case/Lingo/string-case-1.lingo
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
----------------------------------------
|
||||
-- Lower to upper case (ASCII only)
|
||||
-- @param {string} str
|
||||
-- @return {string}
|
||||
----------------------------------------
|
||||
on toUpper (str)
|
||||
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
len = str.length
|
||||
repeat with i = 1 to len
|
||||
pos = offset(str.char[i], alphabet)
|
||||
if pos > 0 then put alphabet.char[pos] into char i of str
|
||||
end repeat
|
||||
return str
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
-- Upper to lower case (ASCII only)
|
||||
-- @param {string} str
|
||||
-- @return {string}
|
||||
----------------------------------------
|
||||
on toLower (str)
|
||||
alphabet = "abcdefghijklmnopqrstuvwxyz"
|
||||
len = str.length
|
||||
repeat with i = 1 to len
|
||||
pos = offset(str.char[i], alphabet)
|
||||
if pos > 0 then put alphabet.char[pos] into char i of str
|
||||
end repeat
|
||||
return str
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue