30 lines
797 B
Plaintext
30 lines
797 B
Plaintext
----------------------------------------
|
|
-- 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
|