代码转换:代码的转换

Option Explicit
\' 用于URL编码,暂不支持中文的编码

Dim oString \' 源字符串
oString=\"URL Encoding Tool by multiple1902\"
oString=InputBox(\"请输入编码前字符串\",\"INPUTING\")
\'Function InputBox(Prompt, [Title], [Default], [XPos], [YPos], [HelpFile], [Context])

While Not len(oString)=0
\'循环
oString=InputBox(\"编码完成代码转换,请按Ctrl+C复制。若还需要编码其他字符串请在此输入,否则清空后提交即可\",\"RESULT\",URLEncoding(oString))
Wend

Function URLEncoding(ByVal vstrIn)
\' 对URL进行编码
Dim response,i
For i = 1 To Len(vstrIn)
response = response & IIf(Mid(vstrIn, i, 1) \"=\" And Mid(vstrIn, i, 1) \"?\", \"%\" & DEC_to_HEX(Asc(Mid(vstrIn, i, 1))), Mid(vstrIn, i, 1))
Next
URLEncoding=response
End Function

\' 用途:将十进制转化为十六进制
\' 输入:Dec(十进制数)
\' 输入数据类型:Long
\' 输出:DEC_to_HEX(十六进制数)
\' 输出数据类型:String
\' 输入的最大数为2147483647,输出最大数为7FFFFFFF
Public Function DEC_to_HEX(Dec)
Dim a
DEC_to_HEX = \"\"
Do While Dec > 0
a = CStr(Dec Mod 16)
Select Case a
Case \"10\": a = \"A\"
Case \"11\": a = \"B\"
Case \"12\": a = \"C\"
Case \"13\": a = \"D\"
Case \"14\": a = \"E\"
Case \"15\": a = \"F\"
End Select
DEC_to_HEX = a & DEC_to_HEX
Dec = Dec \\ 16
Loop
End Function

Function IIf(Statement,TruePart,FalsePart)
If Statement Then
IIf=TruePart
Else
IIf=FalsePart
End If
End Function

\' 中文的用这个
Function URLEncoding(vstrIn)
strReturn = \"\"
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
If Abs(Asc(ThisChr))

代码转换:代码的转换