qb64-include/urldecode.bm
2022-09-19 01:27:48 +02:00

19 lines
No EOL
561 B
Text

$if urldecode = undefined then
$let urldecode = defined
Function urldecode$ (strng As String)
Dim Tmpstr As String
Do Until count >= Len(strng)
count = count + 1
Select Case Mid$(strng, count, 1)
Case "%"
Tmpstr = Tmpstr + Chr$(Val("&H" + Mid$(strng, count + 1, 2)))
count = count + 2
Case "+"
Tmpstr = Tmpstr + " "
Case Else
Tmpstr = Tmpstr + Mid$(strng, count, 1)
End Select
Loop
urldecode = Tmpstr
End Function
$end if