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."
热门推荐
10 对患者生日祝福语简短
11 结婚祝福语简短装备
12 周岁祝福语学生文案简短
13 订婚领证祝福语简短精辟
14 导师获奖祝福语大全简短
15 新婚购房祝福语简短精辟
16 牛年祝福语简短的爱人
17 送芒果的祝福语简短
18 送给学长毕业祝福语简短