VB中如何实现URI码的转换?

晨光暮曲 2003-08-19 04:03:29
就像ASP中的Server.HTMLEncode()那和转换出来的一样!
...全文
69 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
boyzhang 2003-09-20
  • 打赏
  • 举报
回复
uping...
FUNDGIRL 2003-09-19
  • 打赏
  • 举报
回复
呵呵.

我不怎么会!
huangyanpeng 2003-09-19
  • 打赏
  • 举报
回复
Function UrlEncode(ByVal urlText As String) As String
Dim i As Long
Dim ansi() As Byte
Dim ascii As Integer
Dim encText As String

ansi = StrConv(urlText, vbFromUnicode)

encText = ""
For i = 0 To UBound(ansi)
ascii = ansi(i)

Select Case ascii
Case 48 To 57, 65 To 90, 97 To 122
encText = encText & chr(ascii)

Case 32
encText = encText & "+"

Case Else
If ascii < 16 Then
encText = encText & "%0" & Hex(ascii)
Else
encText = encText & "%" & Hex(ascii)
End If

End Select
Next i

UrlEncode = encText
End Function
cnhgj 2003-09-19
  • 打赏
  • 举报
回复
引用Microsoft Active Server Pages Object Library

Dim a As ScriptingContext
Dim x As String
x = a.Server.URLEncode("dddd")
晨光暮曲 2003-08-27
  • 打赏
  • 举报
回复
up
晨光暮曲 2003-08-20
  • 打赏
  • 举报
回复
真的没人知吗?
晨光暮曲 2003-08-19
  • 打赏
  • 举报
回复
能讲一下在VB里如何局体实现呢?
有没有样例代码给俺看看吗?
jlum99 2003-08-19
  • 打赏
  • 举报
回复
把asp里的程序改下就成,如果不用现成的,是些标准的算法
晨光暮曲 2003-08-19
  • 打赏
  • 举报
回复
up
晨光暮曲 2003-08-19
  • 打赏
  • 举报
回复
写错了!不是HTMLEncode(),是URLEncode()

1,502

社区成员

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

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