本文介绍了VBA 是否有任何内置的 URL 解码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要解码一个 URL,例如,将 %2E 替换为 .如果没有内置方法,我可以破解一种方法,但我的假设是必须已经存在一个 URL 解码工具.

I just need to decode a URL, for example, replace %2E with .I can hack out a method if one isn't build in, but my assumption is that there must be a URL decoding tool already existing.

推荐答案

没有

但这里有一个:用于 VB 的 URL 编码器和解码器

或者类似的东西(可能不完整):

Or something along the lines of (possibly not complete):

Public Function URLDecode(ByVal strEncodedURL As String) As String
   Dim str As String
   str = strEncodedURL
   If Len(str) > 0 Then
      str = Replace(str, "&amp", " & ")
      str = Replace(str, "&#03", Chr(39))
      str = Replace(str, "&quo", Chr(34))
      str = Replace(str, "+", " ")
      str = Replace(str, "%2A", "*")
      str = Replace(str, "%40", "@")
      str = Replace(str, "%2D", "-")
      str = Replace(str, "%5F", "_")
      str = Replace(str, "%2B", "+")
      str = Replace(str, "%2E", ".")
      str = Replace(str, "%2F", "/")

      URLDecode = str
  End If

End Function

另外,看看我该怎么办在 Excel VBA 中对字符串进行 URL 编码?

这篇关于VBA 是否有任何内置的 URL 解码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 06:57