VB中二维数组赋值问题
string型一维数组a(0to29),值为:a(0)="0,0,0"a(1)="1,100,0"a(2)="2,200,0"……,现在想把它拆开,赋给二维数组b(0to...
string型一维数组a(0 to 29), 值为:a(0)="0,0,0" a(1)="1,100,0" a(2)="2,200,0" …… ,现在想把它拆开,赋给二维数组b(0 to29,0 to2), 用split函数时一直提示维度错误,请高手指点,感激不尽。
展开
2个回答
展开全部
Dim a(0 To 29) As String, b() As String
Dim i As Integer, j As Integer
ReDim b(UBound(a), 2)
For i = 0 To UBound(a)
a(i) = i & "," & i * 100 & "," & i
Next
For i = 0 To UBound(a)
For j = 0 To 2
b(i, j) = Split(a(i), ",")(j)
Next
Next
Dim i As Integer, j As Integer
ReDim b(UBound(a), 2)
For i = 0 To UBound(a)
a(i) = i & "," & i * 100 & "," & i
Next
For i = 0 To UBound(a)
For j = 0 To 2
b(i, j) = Split(a(i), ",")(j)
Next
Next
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询