是unicode编码的,就是一个字母都是 两个字节的。这样,我一个英文的string 转换成byte() 就会出现0

其实本来想写个 string和byte数组 互转的函数:

'有问题函数,请勿使用
Public Function string2bytes(ByVal str As String) As Byte()
    Dim mulBits() As Byte
    mulBits = str
    myDebug UBound(mulBits)
    string2bytes = mulBits
End Function

Public Function bytes2string(ByRef bytes() As Byte) As String
    Dim str As String
    str = bytes()
    bytes2string = str
End Function

string len为 8 的字符串,编程 bytes数组 就是 ubound为 15 (从0开始)了。

所以 上面的函数要小改一下。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-02-25
  • 2021-06-23
  • 2022-12-23
  • 2021-06-12
猜你喜欢
  • 2022-12-23
  • 2021-07-20
  • 2021-08-03
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案