Advertisement
1_2002 String Manipulation #105693

HTTPSafeString

Makes a string http querystring friendly by replacing all non-alpha and non-numeric characters with the appropriate hex code. Helpful when using the wininet API. example: "(Find This)" becomes "%28Find%20This%29"

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
Public Function HTTPSafeString(Text As String) As String
  Dim lCounter As Long
  Dim sBuffer As String
  Dim sReturn As String
  
  sReturn = Text
  
  For lCounter = 1 To Len(Text)
    sBuffer = Mid(Text, lCounter, 1)
    If Not sBuffer Like "[a-z,A-Z,0-9]" Then
      sReturn = Replace(sReturn, sBuffer, "%" & Hex(Asc(sBuffer)))
    End If
  Next lCounter
  
  HTTPSafeString = sReturn
      
End Function
Komentar Asli (3)
Dipulihkan dari Wayback Machine