Visual Basic 6.0
Visual Basic 6.0
URL Encoding and Decoding
See more Encryption Examples
Demonstrates URL encoding and decoding.Chilkat Visual Basic 6.0 Downloads
Dim success As Long
success = 0
' To URL encoding a string:
Dim s As String
s = "Why a > b?"
Dim sb As New ChilkatStringBuilder
success = sb.Append(s)
' URL encode the string.
success = sb.Encode("url","utf-8")
' Show the URL encoded string:
Dim sEncoded As String
sEncoded = sb.GetAsString()
Debug.Print sEncoded
' The result is: Why%20a%20%3E%20b%3F
' If you prefer "+" instead of "%20" for SPACE chars:
Dim numReplaced As Long
numReplaced = sb.Replace("%20","+")
Debug.Print sb.GetAsString()
' Output is: Why+a+%3E+b%3F
' To decode:
success = sb.Decode("url","utf-8")
Debug.Print sb.GetAsString()
' Result is: Why a > b?