-1
我是VBA新手,有一個基本問題Excel VBA。如何將字符串「Hello World」轉換爲數字向量
我想將字符串「hello world」轉換爲數字向量。
是否有內置函數可以做到這一點?
在Matlab中,它就像編寫double('hello world')
一樣簡單,然後你得到一個向量,然後我可以操作數字。
謝謝
我是VBA新手,有一個基本問題Excel VBA。如何將字符串「Hello World」轉換爲數字向量
我想將字符串「hello world」轉換爲數字向量。
是否有內置函數可以做到這一點?
在Matlab中,它就像編寫double('hello world')
一樣簡單,然後你得到一個向量,然後我可以操作數字。
謝謝
它看起來像你想要將字符串轉換爲字節數組。
默認情況下,像「Hello World」的字符串是多字節字符數組,但你可以使用中StrConv將它們轉換爲ASCII字節:
Sub foo()
Dim str As String
str = "Hello World"
Dim aChars() As Byte
aChars = StrConv(str, vbFromUnicode)
For i = LBound(aChars) To UBound(aChars)
Debug.Print aChars(i)
Next i
End Sub
嗯......什麼數字你希望?在ASCII表中的位置?你應該解釋一下這個Matlab轉換器的功能 –