Split Function

αžαŸ’αžšαž‘αž”αŸ‹β€‹αž’αžΆαžšαŸβ€‹αž“αŸƒβ€‹αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžšβ€‹αžšαž„ αž–αžΈβ€‹αž€αž“αŸ’αžŸαŸ„αž˜β€‹αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžšβ€‹αž˜αž½αž™Β αŸ”

Syntax:


Split (Text As String, delimiter, number)

Return value:

αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžš

Parameters:

Text αŸ– αž€αž“αŸ’αžŸαŸ„αž˜β€‹αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžšβ€‹αžŽαžΆβ€‹αž˜αž½αž™Β αŸ”

αžŸαž‰αŸ’αž‰αžΆβ€‹αž”αŸ†αž”αŸ‚αž€ (αžŸαŸ’αžšαŸαž…β€‹αž…αž·αžαŸ’αž)Β αŸ– αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžšβ€‹αž”αŸ’αžšαžœαŸ‚αž„β€‹αž˜αž½αž™ αž¬β€‹αž…αŸ’αžšαžΎαž“β€‹αžαž½αž’αž€αŸ’αžŸαžš αžŠαŸ‚αž›β€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“β€‹αž”αŸ’αžšαžΎβ€‹αžŠαžΎαž˜αŸ’αž”αžΈβ€‹αž”αŸ†αž”αŸ‚αž€β€‹αž’αžαŸ’αžαž”αž‘Β αŸ” αž›αŸ†αž“αžΆαŸ†αžŠαžΎαž˜β€‹αž‚αžΊβ€‹αžαž½αž’αž€αŸ’αžŸαžšβ€‹αžŠαž€αžƒαŸ’αž›αžΆΒ αŸ”

αž›αŸαž (αžŸαŸ’αžšαŸαž…β€‹β€‹β€‹αž…αž·αžαŸ’αž) αŸ– αž…αŸ†αž“αž½αž“β€‹αžαŸ’αžŸαŸ‚β€‹αž’αž€αŸ’αžŸαžšβ€‹αžšαž„ αžŠαŸ‚αž›β€‹αž’αŸ’αž“αž€β€‹αž…αž„αŸ‹β€‹αžαŸ’αžšαž‘αž”αŸ‹Β αŸ”

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!