dim a as string="a,b,c"
dim b()as string
b=split(a,",")
for i = 1 to Len(a)
b(i - 1) = Mid(a, i, 1)
Next
结果:
b(0) = "a"
b(1) = "b"
b(2) = "c"
Dim a As String = "abc"
Dim b As String()
ReDim b(a.Length)
For i = 1 To a.Length
b(i - 1) = Mid(a, i, 1)
Next
符合VB.NET习惯的转换方式如下:
Dim a As String = "abc"
Dim b() As String
Dim c() As Char = a.ToCharArray()
Dim i As Integer
ReDim b(a.Length - 1)
For i = 0 To a.Length - 1
b(i) = c(i).ToString
Next