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."
热门推荐
5 入学校简短祝福语
10 朋友药店开业祝福语简短
11 迎新祝福语简短20字
12 新年祝福语大全简短老师
13 祝贺新婚祝福语古代简短
14 项目建设春节祝福语简短
15 新婚祝福语简短句子
16 升职蛋糕祝福语大全简短
17 写给少女祝福语的话简短
18 租房明天搬家祝福语简短