Mrs. Endang’s letter board: the separators netted, the pieces numbered by their index, from the real split. What does an empty string give, and what does a…
Why it matters
split reads CSV, breaks up input, paths and URLs, takes a file extension. Misread the empty string or a separator at an edge, and empty elements sneak in as the "why is there an empty string in my array" bug.
The key idea
split throws the separator away and keeps everything between, empty pieces too
Try it in this playground
Split a text with an emoji using the separator '' One emoji tile gets two rings: split cuts between its two code units, so two broken halves come out.
Use a limit that cuts The rest of the text, never read, dims. It is dropped, not joined onto the last element.
Make an empty string show up, then clean it Write two separators side by side or one at an end, then switch .filter(Boolean) on.
Call split with no argument The result is one element, the whole string. Compare with a space separator.