vb.net编解码url
来源:互联网 发布:英语教学软件下载 编辑:程序博客网 时间:2024/04/29 13:34
解码:
Public Function URLDecode(sEncodedURL As String) As String On Error Goto Catch Dim iLoop As Integer Dim sRtn As String Dim sTmp As String If Len(sEncodedURL) > 0 Then For iLoop = 1 To Len(sEncodedURL) sTmp = Mid(sEncodedURL, iLoop, 1) sTmp = Replace(sTmp, "+", " ") If sTmp = "%" and LEN(sEncodedURL) > iLoop + 2 Then sTmp = Mid(sEncodedURL, iLoop + 1, 2) sTmp = Chr(CDec("&H" & sTmp)) iLoop = iLoop + 2 End If sRtn = sRtn & sTmp Next iLoop URLDecode = sRtn End If Finally: Exit Function Catch: URLDecode = "" Resume FinallyEnd Function
编码:
Public Function URLEncode(sRawURL As String) As String On Error Goto Catch Dim iLoop As Integer Dim sRtn As String Dim sTmp As String Const sValidChars = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:/.?=_-$(){}~&" If Len(sRawURL) > 0 Then For iLoop = 1 To Len(sRawURL) sTmp = Mid(sRawURL, iLoop, 1) If InStr(1, sValidChars, sTmp, vbBinaryCompare) = 0 Then sTmp = Hex(Asc(sTmp)) If sTmp = "20" Then sTmp = "+" ElseIf Len(sTmp) = 1 Then sTmp = "%0" & sTmp Else sTmp = "%" & sTmp End If End If sRtn = sRtn & sTmp Next iLoop URLEncode = sRtn End If Finally: Exit Function Catch: URLEncode = "" Resume FinallyEnd Function
0 0
- vb.net编解码url
- VB URL的编解码源码 GB2312 UTF-8编解码
- VB Base64编解码
- URL编解码函数
- URL编解码示例
- URL编解码
- URL 编解码
- C++编解码URL
- C++ URL编解码
- URL编解码
- URL编解码
- Url编解码
- URL编解码
- url的编解码
- url编解码
- iOS-URL编解码
- url编解码与base64编解码
- VB实现Base64 编解码
- 动画演示10个有趣但毫无用处的Linux命令
- 第二周作业
- 转意字符
- EPOLL使用注意
- 关于字符串的一个问题的解决所想到的
- vb.net编解码url
- 算法训练-铁轨
- IIS7.5 配置 PHP 5.3.5
- 正则表达式大全
- 详解大端模式和小端模式
- ASP.NET中实现页面间数据传递的方法
- 正则表达式(三)分支条件 分组
- 硬盘文件删除掉之后怎么恢复
- C和指针 学习笔记——第三章 数据