Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 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
|
||||
5
Task/String-case/Lingo/string-case-2.lingo
Normal file
5
Task/String-case/Lingo/string-case-2.lingo
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
put toUpper("alphaBETA")
|
||||
-- "ALPHABETA"
|
||||
|
||||
put toLower("alphaBETA")
|
||||
-- "alphabeta"
|
||||
Loading…
Add table
Add a link
Reference in a new issue