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

posted @ 2020-10-23 13:51  它的眼角开过光  阅读(315)  评论(0编辑  收藏  举报