dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB4,VB5,VB6,VBS
Expertise: Intermediate
Jan 27, 2001

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


URLPathEncode - Convert a string for using on a URL path

' convert a string so that it can be used on a URL path
'
' Same effect as the Server.URLPathEncode method in ASP

Function URLPathEncode(ByVal Text As String) As String
    Dim i As Integer
    Dim acode As Integer
    
    URLPathEncode = Text
    
    For i = Len(URLPathEncode) To 1 Step -1
        acode = Asc(Mid$(URLPathEncode, i, 1))
        Select Case acode
            Case 48 To 57, 65 To 90, 97 To 122
                ' don't touch alphanumeric chars
            Case 33, 35, 36, 38, 42, 43, 45, 46, 47, 58, 63, 64, 95, 126
                ' these punctuation chars require no translation
            Case Else
                ' replace other chars with "%hex"
                URLPathEncode = Left$(URLPathEncode, i - 1) & "%" & Hex$(acode) _
                    & Mid$(URLPathEncode, i + 1)
        End Select
    Next
    
End Function

Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date