vb 怎么讲字符串转化为字符数组

例如将TEXT中的输入的HELLO转化为单个字母送入字符数组
2024-12-16 23:01:28
推荐回答(5个)
回答1:

直接将text中的每个字符循环取出

Dim mystr() As String
Dim i as integer
Redim mystr(len(TEXT1.TEXT))

for i=1 to len(TEXT1.TEXT)
mystr(i)=mid(TEXT1.TEXT,i,1)
next

回答2:

//已知 text.text = "HELLO"
Dim s = text.text
s = "HELLO"
Dim arr() As Char
arr = s.ToCharArray()
这样就可以把“hello”存入数组“arr”中

回答3:

Dim mytext AS String
Dim str(1) As String
mytext = text1.text
Redim str(len(text1.text))
str = split(mytext, "")

回答4:

l=len(text1.text)
Dim a()As String
for i=0 to l-1
a(i)=mid(text1.text,i,1)
next

回答5:

Dim hArray() as string

hArray=Split(Text1.text ,vbnullstring)