打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
请问VB中URLEncode怎写?
userphoto

2012.11.23

关注
VB post 提交中文信息需要进行Content-Type: application/x-www-form-urlencoded编码。
代码如下:
Public Function URLEncode(ByVal strParameter As String) As String
Dim s As String
Dim I As Integer
Dim intValue As Integer

Dim TmpData() As Byte

    s = ""
    TmpData = StrConv(strParameter, vbFromUnicode)
    For I = 0 To UBound(TmpData)
        intValue = TmpData(I)
        If (intValue >= 48 And intValue <= 57) Or _
            (intValue >= 65 And intValue <= 90) Or _
            (intValue >= 97 And intValue <= 122) Then
            s = s & Chr(intValue)
        ElseIf intValue = 32 Then
            s = s & "+"
        Else
            s = s & "%" & Hex(intValue)
        End If
    Next I
    URLEncode = s

End Function
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
VB实用代码,收藏!!
vba 读写文本文件
【pinterest】URL批量编码工具
urlencode
VB基础知识-数据类型
VB爱好者乐园(VBGood) - 经验之谈 - VB编程的必备技巧
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服