url的问题。。。。急...

sdpong 2001-12-19 12:50:38
在vb中怎样将带中文的联接
http://myserver/%c9%fa%b2%fa%b2%bf/
变成类
如http://myserver/生产部/
...全文
60 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
playyuer 2001-12-19
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
VBA.MsgBox DecodeString("http://myserver/%c9%fa%b2%fa%b2%bf/")
End Sub
Public Function DecodeString(StringX As String) As String
Dim i As Long
Dim sByte() As Byte
Do Until i > VBA.Len(VBA.Trim(StringX)) ' - 1
i = i + 1
If VBA.Mid(StringX, i, 1) <> "%" Then
DecodeString = DecodeString & VBA.Mid(StringX, i, 1)
Else
i = i + 1
ReDim sByte(0) As Byte
sByte(0) = VBA.Val("&H" & VBA.Mid(StringX, i, 2))
If Val("&H" & VBA.Mid(StringX, i, 2)) > 128 Then
i = i + 3
ReDim Preserve sByte(1) As Byte
sByte(1) = VBA.Val("&H" & VBA.Mid(StringX, i, 2))
DecodeString = DecodeString & VBA.StrConv(sByte, vbUnicode)
Else
DecodeString = DecodeString & VBA.StrConv(sByte, vbUnicode)
End If
i = i + 1
End If
Loop
End Function

URL 编码解码程序 (VB CGI、Winsock 提交 Web 含汉字表单域要用到)!
http://www.csdn.net/expert/topic/357/357810.shtm

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧