Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
3
Task/URL-encoding/REALbasic/url-encoding-1.basic
Normal file
3
Task/URL-encoding/REALbasic/url-encoding-1.basic
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Dim URL As String = "http://foo bar/"
|
||||
URL = EncodeURLComponent(URL)
|
||||
Print(URL)
|
||||
21
Task/URL-encoding/REALbasic/url-encoding-2.basic
Normal file
21
Task/URL-encoding/REALbasic/url-encoding-2.basic
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue