split能不能取出二维数组
rt:具体怎么实现,谢谢
Dim str As String Dim Our() As String
Private Sub Command1_Click() Dim n1 As Long, n2 As Long s1 = Split(str) '确定二维数组的维数 For Each s2 In s1 n1 = n1 + 1 If n1 = 1 Then s3 = Split(s2, "|") For Each s4 In s3 n2 = n2 + 1 Next End If Next ReDim Our(1 To n1, 1 To n2) n1 = 0 s1 = Split(str) '给二维数组赋值 For Each s2 In s1 n1 = n1 + 1 s3 = Split(s2, "|") n2 = 0 For Each s4 In s3 n2 = n2 + 1 Our(n1, n2) = s4 Next Next '查看二维数组的内容 For i = 1 To n1 For j = 1 To n2 MsgBox "our(" & i & "," & j & ")=" & Our(i, j) Next Next End Sub
Private Sub Form_Load() str = "张三|男 李诗|女 王六|男" End Sub