Split s into words and separators. Returns:
s
words[i] — the i-th run of word characters seps[0] — leading non-word characters (possibly empty) seps[i] — for 1 ≤ i ≤ words.length-1, the separator BETWEEN words[i-1] and words[i] seps[words.length] — trailing non-word characters
words[i-1]
words[i]
Always satisfies seps.length === words.length + 1.
seps.length === words.length + 1
Split
sinto words and separators. Returns:words[i] — the i-th run of word characters seps[0] — leading non-word characters (possibly empty) seps[i] — for 1 ≤ i ≤ words.length-1, the separator BETWEEN
words[i-1]andwords[i]seps[words.length] — trailing non-word charactersAlways satisfies
seps.length === words.length + 1.