Imports System
Imports System.Web
Public Class Program
Public Shared Function EncodeURIComponent(ByVal str As String) As String
Dim result As String
Try
result = HttpUtility.UrlEncode(str).
Replace("+", "%20").
Replace("%21", "!").
Replace("%27", "'").
Replace("%28", "(").
Replace("%29", ")").
Replace("%7E", "~")
Catch __unusedException1__ As Exception
result = str
End Try
Return result
End Function
Public Shared Sub Main(ByVal args As String())
Dim str As String = "https://www.seek4info.com/search.php?query=seo"
Dim encodedStr As String = EncodeURIComponent(str)
Console.WriteLine(encodedStr)
End Sub
End Class
' run:
'
' https%3a%2f%2fwww.seek4info.com%2fsearch.php%3fquery%3dseo
'