byte_str.asp
来自「ASPSQL企业网络管理系统」· ASP 代码 · 共 38 行
ASP
38 行
<%
Function Byte2STR(vIn)
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2STR = strReturn
End Function
Function STR2Byte(vIn)
dim strReturn,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To Len(vIn)
ThisCharCode = hex(AscW(Mid(vIn,i,1)))
if (len(ThisCharCode) mod 2) <> 0 then
ThisCharCode = "0" & ThisCharCode
end if
Response.Write(thischarcode) & "<br>"
If len(ThisCharCode) = 2 Then
strReturn = strReturn & Chr(eval("&h" & ThisCharCode))
Else
NextCharCode = Mid(ThisCharCode,3,2)
ThisCharCode = Mid(ThisCharCode,1,2)
strReturn = strReturn & Chr(eval("&h" & ThisCharCode)) & Chr(eval("&h" & NextCharCode))
Response.Write("&h" & ThisCharCode & ":" & eval("&h" & ThisCharCode)) & ":" & Chr(eval("&h" & ThisCharCode)) & "<BR>"
Response.Write("&h" & NextCharCode & ":" & eval("&h" & NextCharCode)) & ":" & Chr(eval("&h" & NextCharCode)) & "<BR>"
End If
Next
STR2Byte = strReturn
End Function
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?