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

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1737504573, '18.118.1.100', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/VBA/functions/string/split(67): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78