Split函數的使用方法

2019-11-16 01:30:00
zstmtony
原創
171
Sub test1()
    Dim strTest As String
    Dim arrResult() As String
    Dim i As Integer
    strTest = "abc, edf, hij, klm"
    arrResult = VBA.Split(strTest , ",", 3)
    For i = LBound(arrResult) To UBound(arrResult)
        Debug.Print Trim(arrResult(i))
    Next i
End Sub


文本不區分大小寫


Sub test2()
    Dim strTest As String
    Dim arrResult() As String
    Dim i As Integer
    strTest = "AAAsBBBSCCCsDDDsEEEFF"
    arrResult = VBA.Split(strTest , delimiter:="s", compare:=vbTextCompare)
    For i = LBound(arrResult) To UBound(arrResult)
        Debug.Print Trim(arrResult(i))
    Next i
End Sub


分享
北京十一选五基本走势