Splitting text sounds like a one-liner (text.split(",")) and turns into a mess the moment the constraint is external: a 160-character SMS limit, a 4000-character API request cap, a 500-line SQL migration.
The text splitter covers the three ways that actually come up, and shows every chunk with its length so you can see what you are working with.
Three ways to cut, three different problems
By delimiter is the honest one. You know the structure — lines, commas, blank lines between paragraphs — and you cut exactly there. Nothing is ever cut mid-word, because you never cut mid-word.
By character count is what outside limits force on you. An SMS is 160 characters in GSM-7 (only 70 once the text leaves Latin script); a tweet used to be 140; a database column has a maximum length. Here you will cut words in half, and you have to decide whether that is acceptable (it usually is, for machine input) or whether you should split on the nearest space instead.
By line count is for code and data. A 5000-line SQL file split into 500-line chunks stays syntactically meaningful; the same file split at 10000 characters does not.
The details that bite
Trailing separators. Splitting a,b,c on , gives three chunks that no longer contain the comma. If you are reassembling them later, keep the delimiter — the tool has a checkbox for exactly this.
Empty chunks. a,,b produces an empty string in the middle. Often you want it gone; sometimes it is meaningful (a blank line is a paragraph break). Keep or drop, deliberately.
CRLF versus LF. Windows files use \r\n. Splitting on \n leaves a \r at the end of every chunk, which quietly breaks string comparisons later. Browsers normalise this for pasted text, but files read from disk may not.
Multibyte characters. “Character” can mean byte, UTF-16 code unit, or Unicode code point, and the three disagree for emoji and CJK text. A splitter that counts UTF-16 units cuts an emoji in half and emits broken text; this one counts code points, so an emoji is one character and survives the cut.
A workflow that works
- Paste the text.
- Pick the constraint you actually have — not the one that is convenient.
- Check the chunk count and the lengths in the header of each block.
- Copy all if you are moving them as a set; copy one if you are fixing a single piece.
If the result looks wrong, the mode is almost always the culprit: character mode on text that should be split on lines gives dozens of chunks that start mid-word.