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

sdpong 2001-12-19 12:50:38
在vb中怎样将带中文的联接
http://myserver/%c9%fa%b2%fa%b2%bf/
变成类
如http://myserver/生产部/
...全文
50 1 打赏 收藏 举报
写回复
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
相关推荐
发帖
VB基础类

7681

社区成员

VB 基础类
社区管理员
  • VB基础类社区
加入社区
帖子事件
创建了帖子
2001-12-19 12:50
社区公告
暂无公告