Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,3 @@
Dim URL As String = "http://foo bar/"
URL = EncodeURLComponent(URL)
Print(URL)

View file

@ -0,0 +1,21 @@
Function URLEncode(Data As String, ParamArray Exceptions() As String) As String
Dim buf As String
For i As Integer = 1 To Data.Len
Dim char As String = Data.Mid(i, 1)
Select Case Asc(char)
Case 48 To 57, 65 To 90, 97 To 122, 45, 46, 95
buf = buf + char
Else
If Exceptions.IndexOf(char) > -1 Then
buf = buf + char
Else
buf = buf + "%" + Left(Hex(Asc(char)) + "00", 2)
End If
End Select
Next
Return buf
End Function
'usage
Dim s As String = URLEncode("http://foo bar/") ' no exceptions
Dim t As String = URLEncode("http://foo bar/", "!", "?", ",") ' with exceptions