阿有那位好心的大侠帮我翻译一下以下的语言什么意思啊?先谢谢了 10
FunctiontoWideChar(vstrIn)strReturn=""Fori=1ToLen(vstrIn)ThisChr=Mid(vStrIn,i,1)IfAbs...
Function toWideChar(vstrIn)
strReturn = ""
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
If Abs(Asc(ThisChr)) < &HFF Then
innerCode = Asc(ThisChr)
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00)\ &HFF
Low8 = Hex(innerCode And &HFF - 32)
If (Len(Low8) < 2) Then
while (Len(Low8) < 2)
Low8 = "0" & Low8
Wend
End If
strReturn = strReturn & "%uff" & Low8
Else
strReturn = strReturn & ThisChr
End If
Next
toWideChar = strReturn
End Function
Function URLEncoding(vstrIn)
strReturn = ""
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
x = Asc(ThisChr)
If ThisChr = "&" Or ThisChr = "%" Or ThisChr = "=" Or ThisChr = "+" Or ThisChr = "?" Then
'If x < &H30 Or x > &H80 Or (x > 39 And x < &H40) Then
strReturn = strReturn & "%" & Hex(Asc(ThisChr))
ElseIf Abs(x) < &HFF Then
strReturn = strReturn & ThisChr
Else
innerCode = x
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00)\ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
End If
Next
URLEncoding = strReturn
End Function 展开
strReturn = ""
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
If Abs(Asc(ThisChr)) < &HFF Then
innerCode = Asc(ThisChr)
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00)\ &HFF
Low8 = Hex(innerCode And &HFF - 32)
If (Len(Low8) < 2) Then
while (Len(Low8) < 2)
Low8 = "0" & Low8
Wend
End If
strReturn = strReturn & "%uff" & Low8
Else
strReturn = strReturn & ThisChr
End If
Next
toWideChar = strReturn
End Function
Function URLEncoding(vstrIn)
strReturn = ""
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
x = Asc(ThisChr)
If ThisChr = "&" Or ThisChr = "%" Or ThisChr = "=" Or ThisChr = "+" Or ThisChr = "?" Then
'If x < &H30 Or x > &H80 Or (x > 39 And x < &H40) Then
strReturn = strReturn & "%" & Hex(Asc(ThisChr))
ElseIf Abs(x) < &HFF Then
strReturn = strReturn & ThisChr
Else
innerCode = x
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00)\ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
End If
Next
URLEncoding = strReturn
End Function 展开
展开全部
你在网上搜索东西的时候,应该会注意到,当你搜索内容为中文时,网址中会出现一堆%AA%BB%CC一类的东西
这两个函数中,下面那段就是负责把中文变成这样的,而上面一段应该是反过来的,应该可以把这样的“乱码”变回中文
但是经我测试,好像上面的代码不正确啊
Private Sub Command1_Click()
Debug.Print URLEncoding("碧海银沙")
Debug.Print toWideChar("%B1%CC%BA%A3%D2%F8%C9%B3")
End Sub
用下面的函数可以把“碧海银沙”变成“%B1%CC%BA%A3%D2%F8%C9%B3”,但用上面的函数却不能把“%B1%CC%BA%A3%D2%F8%C9%B3”变回“碧海银沙”
你试试就知道了
这两个函数中,下面那段就是负责把中文变成这样的,而上面一段应该是反过来的,应该可以把这样的“乱码”变回中文
但是经我测试,好像上面的代码不正确啊
Private Sub Command1_Click()
Debug.Print URLEncoding("碧海银沙")
Debug.Print toWideChar("%B1%CC%BA%A3%D2%F8%C9%B3")
End Sub
用下面的函数可以把“碧海银沙”变成“%B1%CC%BA%A3%D2%F8%C9%B3”,但用上面的函数却不能把“%B1%CC%BA%A3%D2%F8%C9%B3”变回“碧海银沙”
你试试就知道了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询