VBA 与字节数组之间的分配
示例
字符串可以直接分配给字节数组,反之亦然。请记住,字符串存储在多字节字符集中(请参见下面的备注),因此只有结果数组的所有其他索引才是属于ASCII范围内的字符部分。
Dim bytes() As Byte Dim example As String example = "Testing." bytes = example 'Direct assignment. 'Loop through the characters. Step 2 is used due to wide encoding. Dim i As Long For i = LBound(bytes) To UBound(bytes) Step 2 Debug.PrintChr$(bytes(i)) 'Prints T, e, s, t, i, n, g, . Next Dim reverted As String reverted = bytes 'Direct assignment. Debug.Print reverted 'Prints "Testing."
热门推荐
7 简短的二胎祝福语
10 简短霸气女儿生日 祝福语
11 祝福语高考小众诗句简短
12 元旦祝福语20秒简短
13 老师过年祝福语大全 简短
14 一生祝福语简短
15 产检祝福语简短霸气
16 朋友店开张祝福语简短
17 生日爱情祝福语大全简短
18 朋友女儿生日祝福语 简短