Split Function

แƒกแƒขแƒ แƒฃแƒœแƒ’แƒฃแƒšแƒ˜ แƒ’แƒแƒ›แƒแƒกแƒแƒฎแƒฃแƒšแƒ”แƒ‘แƒ˜แƒ“แƒแƒœ แƒแƒ‘แƒ แƒฃแƒœแƒ”แƒ‘แƒก แƒฅแƒ•แƒ”แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒ”แƒ‘แƒ˜แƒก แƒ›แƒแƒกแƒ˜แƒ•แƒก.

Syntax:


Split (Text As String, delimiter, number)

Return value:

แƒกแƒขแƒ แƒ˜แƒฅแƒแƒœแƒ”แƒ‘แƒ˜

Parameters:

แƒขแƒ”แƒฅแƒกแƒขแƒ˜: แƒœแƒ”แƒ‘แƒ˜แƒกแƒ›แƒ˜แƒ”แƒ แƒ˜ แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒฃแƒšแƒ˜ แƒ’แƒแƒ›แƒแƒกแƒแƒฎแƒฃแƒšแƒ”แƒ‘แƒ.

delimiter (แƒแƒ แƒฉแƒ”แƒ•แƒ˜แƒ—แƒ˜): แƒ”แƒ แƒ—แƒ˜ แƒแƒœ แƒ›แƒ”แƒขแƒ˜ แƒแƒกแƒ-แƒœแƒ˜แƒจแƒœแƒ˜แƒก แƒกแƒ˜แƒ’แƒ แƒซแƒ˜แƒก แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒ˜, แƒ แƒแƒ›แƒ”แƒšแƒ˜แƒช แƒ’แƒแƒ›แƒแƒ˜แƒงแƒ”แƒœแƒ”แƒ‘แƒ แƒขแƒ”แƒฅแƒกแƒขแƒ˜แƒก แƒ’แƒแƒ›แƒแƒกแƒแƒงแƒแƒคแƒแƒ“. แƒกแƒแƒฌแƒงแƒ˜แƒกแƒ˜ แƒœแƒ˜แƒจแƒแƒœแƒ˜แƒ แƒฐแƒแƒ แƒ˜.

number (แƒแƒ แƒฉแƒ”แƒ•แƒ˜แƒ—แƒ˜): แƒ—แƒฅแƒ•แƒ”แƒœแƒ—แƒ•แƒ˜แƒก แƒกแƒแƒกแƒฃแƒ แƒ•แƒ”แƒšแƒ˜ แƒ“แƒแƒกแƒแƒ‘แƒ แƒฃแƒœแƒ”แƒ‘แƒ”แƒšแƒ˜ แƒฅแƒ•แƒ”แƒกแƒขแƒ แƒ˜แƒœแƒ’แƒ”แƒ‘แƒ˜แƒก แƒ แƒแƒแƒ“แƒ”แƒœแƒแƒ‘แƒ.

Example:


Dim a(3)
Sub main()
    a(0) = "ABCDE"
    a(1) = 42
    a(2) = "MN"
    a(3) = "X Y Z"
    JStr = Join1()
    Call Show(JStr, Split1(JStr))
    JStr = Join2()
    Call Show(JStr, Split1(JStr))
    JStr = Join3()
    Call Show(JStr, Split1(JStr))
End Sub
 
Function Join1()
    Join1 = Join(a(), "abc")
End Function
 
Function Join2()
    Join2 = Join(a(), ",")
End Function
 
Function Join3()
    Join3 = Join(a())
End Function
 
Function Split1(aStr)
    Split1 = Split(aStr, "D")
End Function
 
Sub Show(JoinStr, TheArray)
    l = LBound(TheArray)
    u = UBound(TheArray)
    total$ = "=============================" + Chr$(13) + JoinStr + Chr$(13) + Chr$(13)
    For i = l To u
        total$ = total$ + TheArray(i) + Str(Len(TheArray(i))) + Chr$(13)
    Next i
    MsgBox total$
End Sub

Please support us!