Splits a string s
on occurrences of the separator sep
. When sep
is empty, it returns [s]
;
when sep
occurs in overlapping patterns, the first match is taken. There will always be exactly
n+1
elements in the returned list if there were n
nonoverlapping matches of sep
in the string.
The default separator is " "
. The separators are not included in the returned substrings.
"here is some text ".splitOn = ["here", "is", "some", "text", ""]
"here is some text ".splitOn "some" = ["here is ", " text "]
"here is some text ".splitOn "" = ["here is some text "]
"ababacabac".splitOn "aba" = ["", "bac", "c"]