[原创]Split函数分割文本总结+VB二级考试方法【分割文本】
程序代码:
Private Sub Command1_Click() Dim i As Integer Dim a() As String q = "a b c b d" a = Split(q, , -1) For i = 0 To UBound(a) List1.AddItem a(i) '可换为print a(i) 这里用一个list控件 Next i End Sub给新手学习分割文本 下面使用二级VB考试文本分割example
--------------------------------------------------------------
程序代码:
Private Sub Command1_Click() Dim S1 As String, S2 As String Dim I1 As Integer ' S1 = "a b c d e f g" I1 = 1 Do Do While Mid(S1, I1, 1) <> " " And I1 <= Len(S1) S2 = S2 & Mid(S1, I1, 1) I1 = I1 + 1 Loop List1.AddItem S2 S2 = "" I1 = I1 + 1 Loop While I1 <= Len(S1) End Sub这例程是考试内容 不允许用split
给新手 多支持