Search notes:

VBA function: split

split(string, delimiter) creates an array of strings from a string.
Thus, it behaves quite the same as Perl's split function.
option explicit

sub splitDemo()

    dim text as string
    text = "foo,bar,baz"

    dim ary() as string
    ary = split(text, ",")

  ' Note that the returned array is
  ' zero-based. Therefore, we need to
  ' start iterating with i = 0
    for i = 0 to uBound(ary)
        msgBox(ary(i))
    next i

end sub
Github repository about-VBA, path: /functions/split.bas
Note: the returned arrays are always zero based, even if option base 1 is in effect.

See also

The opposite of split is join
VBA functions

Index