请问有没有将ascii转成数字的函数?
用asc可以将数字转换成ascii码,但是有没有可以直接转回来的?比如ascii中的16进制30,有没有可以直接将它转换成数字0的函数?我是想把一传16进制直接转换成对应的数字.
[解决办法]
Dim bytes() As Byte
Dim strASCII As String
Dim strTemp As String
Dim i As Long
strASCII = "test text"
bytes = StrConv(strASCII, vbFromUnicode)
strTemp = ""
For i = LBound(bytes) To UBound(bytes)
strTemp = strTemp & Right("00" & Hex(bytes(i)), 2) & " "
Next i
MsgBox "原文:" & strASCII & vbCrLf & "字节数据:" & strTemp
Dim a(0 To 5) As Byte'一串ASCII
Dim ret As String'结果
a(0) = &H30
a(1) = &H32
a(2) = &H35
a(3) = &H38
a(4) = &H39
a(5) = &H40
ret = StrConv(a, vbUnicode)
Debug.Print ret