byte转string
Private Function ByteArrayToHex(ByRef ByteArray() As Byte) As String Dim lb As Long, ub As Long Dim l As Long, strRet As String Dim lonRetLen As Long, lonPos As Long Dim strHex As String, lonLenHex As Long lb = LBound(ByteArray) ub = UBound(ByteArray) lonRetLen = ((ub - lb) + 1) * 3 strRet = Space$(lonRetLen) lonPos = 1 For l = lb To ub strHex = Hex$(ByteArray(l)) If Len(strHex) = 1 Then strHex = "0" & strHex If l <> ub Then Mid$(strRet, lonPos, 3) = strHex & " " lonPos = lonPos + 3 Else Mid$(strRet, lonPos, 3) = strHex End If Next l ByteArrayToHex = strRet End Function
可以将数组转化为字符串