VB字符串分割为数组,并获取下标值
Dim A() As String
Private Sub Command1_Click()
A() = Split(Text1.Text, "-", -1, vbTextCompare)'以“-”将字符串分割后存到一个以下标为0开始的数组里
Dim i As Integer
For i = 0 To UBound(A()) 'UBound(a())返回数组的最大下标LBound(A())返回最小下标
Debug.Print A(i) '将结果打印到即时窗口
Next i
End Sub