手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

VB函数 - URL Encode

时间:2024-10-12 03:17:21

1、Public Function URLEncode(ByVal strParameter As String) As StringDim s As StringDim I As IntegerDim intValue As IntegerDim 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 = sEnd Function

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

3、形参为中文等字符。

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

© 手抄报圈