Public Function URLEncode(strInput As String) As String
Dim strOutput As String
Dim intAscii As Integer
Dim i As Integer
For i = 1 To Len(strInput)
intAscii = Asc(Mid(strInput, i, 1))
If ((intAscii < 58) And (intAscii > 47)) Or ((intAscii < 91) And (intAscii > 64)) Or ((intAscii < 123) And (intAscii > 96)) Then
strOutput = strOutput & Chr$(intAscii)
Else
strOutput = strOutput & IIf(intAscii < 16, "%0", "%") & Trim$(Hex$(intAscii))
End If
Next
URLEncode = strOutput
End Function
在VB中实现URLEncode转换
最新推荐文章于 2024-09-05 14:30:09 发布