2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,13 +1,21 @@
Function URLEncode(URL As String, Exceptions As String = "") As String
For i As Integer = 0 To 255
If InStr(Exceptions, Chr(i)) > 0 Then Continue For i
Dim char As String = Chr(127) + Right("00" + Hex(i), 2)
URL = ReplaceAll(URL, Chr(i), char)
If i = 47 Then i = 57
If i = 64 Then i = 90
If i = 96 Then i = 122
If i = 126 Then i = 128
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
URL = ReplaceAll(URL, Chr(127), "%")
Return URL
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