|
本帖最后由 VBA万岁 于 2014-11-19 11:23 编辑
renahu 发表于 2014-11-19 10:48 ![](http://club.excelhome.net/static/image/common/back.gif)
还是没明白下面这句话什么意思,干脆你直接改一下,发上来我看看
如“$”转义后为“\u0024”,则可将第3 ...
160楼链接网页中的表格(一)共有144个待转换的字符,我只在常变量中用了其中常见的字符,其他的全用数字(共凑足144个字符)代替了,之所以用0~9数字占位代替,主要是为了方便找到位置,以便替换具体的字符。
Function URLencode(strASCII As String) As String
Dim arr, i, n
Const str As String = "12345678901234567890123$567890123456789@ABCDEFGHIPQRSTUVWXY`abcdefghipqrstuvwxy01234567890123456789001*+,-./:;<=>?JKLMNOZ[\]^_jklmnoz{|}~ 345678"
arr = Array("a", "b", "c", "d", "e", "f")
For i = 1 To Len(strASCII)
n = InStr(str, Mid(strASCII, i, 1))
If n <= 90 Then URLencode = URLencode & "\u00" & n Else URLencode = URLencode & "\u00" & Int((n - 91) / 6) & arr((n - 91) Mod 6)
Next
End Function
|
|