VB函数 - URL Encode

 时间:2026-02-14 20:30:03

1、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

2、这个VB的函数,可以把中文转化为相应的URL Encode。

3、形参为中文等字符。

4、返回值为形参对应的URL Encode。

  • 四季豆土豆炖肉
  • 牙周检查流程和注意事项
  • win7 XNA4.0安装失败,错误代码2350怎么办
  • VS中自动键盘切换如何进行关闭
  • 奇迹仙侠新手怎么玩?
  • 热门搜索
    电脑文件夹怎么设置密码 芪怎么读 爱要怎么说出口 婴儿舌苔厚白是怎么回事 开关怎么接线 晌怎么读 牛鞭怎么做好吃 苹果电脑怎么切换系统 钟汉良为什么叫小哇 狗为什么不能吃巧克力