June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,24 @@
----------------------------------------
-- URL decodes a string
-- @param {string} str
-- @return {string}
----------------------------------------
on urldecode (str)
res = ""
ba = bytearray()
len = str.length
repeat with i = 1 to len
c = str.char[i]
if (c = "%") then
-- fastest hex-to-dec conversion hack based on Lingo's rgb object
ba.writeInt8(rgb(str.char[i+1..i+2]).blue)
i = i + 2
else if (c = "+") then
ba.writeInt8(32)
else
ba.writeInt8(chartonum(c))
end if
end repeat
ba.position = 1
return ba.readRawString(ba.length)
end

View file

@ -0,0 +1,2 @@
put urldecode("http%3A%2F%2Ffoo%20bar%2F")
put urldecode("google.com/search?q=%60Abdu%27l-Bah%C3%A1")