求大神翻译!
初学者 求大神翻译。
Public Function URLEncode(ByVal strParameter As String) As String
Dim s As String
Dim i As Integer
Dim intValue As Integer
Dim TmpData() As Byte
s = " "
TmpData = StrConv(strParameter, vbFromUnicode)
For i = 0 To UBound(TmpData)
intValue = TmpData(i)
If (intValue >= 48 And intValue <= 57) Or _
(intValue >= 65 And intValue <= 90) Or _
(intValue >= 97 And intValue <= 122) Then
s = s & Chr(intValue)
ElseIf intValue = 32 Then
s = s & "+ "
Else
s = s & "%" & Hex(intValue)
End If
Next i
URLEncode = s
Public Function URLEncode(ByVal strParameter As String) As String
Dim s As String
Dim i As Integer
Dim intValue As Integer
Dim TmpData() As Byte
s = " "
TmpData = StrConv(strParameter, vbFromUnicode) '将字符串转换成字节数组
For i = 0 To UBound(TmpData) '循环字节数组
intValue = TmpData(i)
If (intValue >= 48 And intValue <= 57) Or _
(intValue >= 65 And intValue <= 90) Or _
(intValue >= 97 And intValue <= 122) Then '分别是0-9范围,A-Z范围,a-z范围内
s = s & Chr(intValue) '统计
ElseIf intValue = 32 Then '32是空格
s = s & "+ "
Else
s = s & "%" & Hex(intValue)
End If
Next i
URLEncode = s
End Function