Split Function

๋ฌธ์ž์—ด ์‹์—์„œ ๋ถ€๋ถ„ ๋ฌธ์ž์—ด์˜ ๋ฐฐ์—ด์„ ๊ตฌํ•ฉ๋‹ˆ๋‹ค.

๊ตฌ๋ฌธ:


Split (Text As String, delimiter, number)

๋ฐ˜ํ™˜ ๊ฐ’:

String

๋งค๊ฐœ ๋ณ€์ˆ˜:

Text: ์ž„์˜์˜ ๋ฌธ์ž์—ด ์‹์ž…๋‹ˆ๋‹ค.

๊ตฌ๋ถ„ ๊ธฐํ˜ธ(์˜ต์…˜): Text๋ฅผ ๊ตฌ๋ถ„ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š”, ํ•˜๋‚˜ ์ด์ƒ์˜ ๋ฌธ์ž๋กœ ์ด๋ฃจ์–ด์ง„ ๋ฌธ์ž์—ด์ž…๋‹ˆ๋‹ค. ๊ธฐ๋ณธ๊ฐ’์€ ๊ณต๋ฐฑ ๋ฌธ์ž์ž…๋‹ˆ๋‹ค.

number(์„ ํƒ์ ): ๊ตฌํ•  ๋ถ€๋ถ„ ๋ฌธ์ž์—ด์˜ ๊ฐœ์ˆ˜์ž…๋‹ˆ๋‹ค.

์˜ˆ:


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!