Text Split to List
Turn one big string into a list of pieces
- ARRAY
- strings
- count
Every batch workflow starts the same way: with a wall of text that needs to become a list of individual prompts. Text Split to List is where that happens. Type cat, forest, sunset in, get three entries out, and suddenly everything below can iterate - one render per tag, one video per line, one image per filename.
How you cut it
The split_by dropdown chooses the rule, and it reads the delimiter field only for two of them:
- delimiter - the default. Cuts on the exact text in the delimiter field, so a comma-split prompt becomes one entry per tag. Type
\nfor a line break or\tfor a tab. - regex - reads the same field as a regular expression, so
[,;]cuts on either a comma or a semicolon. An unreadable pattern stops with the error it produced, naming the position that failed - which is friendlier than it sounds. - lines - cuts on line breaks, ignoring the delimiter field.
- whitespace - cuts on runs of space.
- characters - every character becomes its own entry. Rarely useful, but it's there when you need to process a string one letter at a time.
Two hygiene toggles sit under it. trim_whitespace (on by default) strips surrounding space from each piece, so 'a, b, c' gives 'a', 'b', 'c' rather than carrying spaces into whatever reads the list. And remove_empty (also on by default) drops pieces that hold nothing - the empty piece a trailing comma leaves behind. Turn it off when the position of every entry matters and an empty slot has to stay a slot, because two delimiters in a row always produce one empty piece.
What comes out
Like the other list nodes, the pieces come out twice:
- ARRAY - every piece on one wire, for the list-native nodes: Text List Get, Text List Concatenate, Text List to Text.
- strings - the same pieces as a STRING list. Wire this into a sampler's prompt and the graph runs once per piece, rendering every entry in turn. This is the output that turns a batch of comma-separated prompts into a batch of images.
- count - how many pieces the split produced.
The always-true rule applies here too: text that splits into nothing stops the prompt, because a graph can't run zero times. With remove_empty on and input that's only delimiters, you can absolutely hit that - so it's worth knowing the error message when you do.
The shape to remember
This node is the front door of the pack's whole text-list ecosystem. Downstream you have Get, Slice, Length, and the fan-out nodes; upstream you have anything that produces a string. A CSV of shot descriptions, a tag list pulled from a file, a prompt you generated with a random line picker - split first, iterate after. That one-two of "split a string" then "feed the strings list to a sampler" is the core move, and it's why this is one of the most-used nodes in the suite.
Installing it
Part of WAS Node Suite v3 (WASasquatch's was-node-suite-comfyui, MIT). Search "WAS Node Suite v3" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git
Restart ComfyUI after installing. Requires ComfyUI 0.14.0+ and Python 3.10+; nothing extra to pip install.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | The text to cut up, as `cat, forest, sunset`. Typed here, or wired in from any node with a text output, such as a prompt built by Text Concatenate. | |
| split_by | COMBO | Where the cuts go. `delimiter` and `regex` read the delimiter field; `lines` cuts on line breaks, `whitespace` on runs of space, `characters` on every character. | |
| delimiter | STRING | , | What to cut on, read only by `delimiter` and `regex`. Type \n for a line break or \t for a tab. An unreadable regular expression stops with the error the pattern produced, naming the position in it that failed. |
| trim_whitespace | BOOLEAN | true | Whether each piece has its surrounding space removed. On, 'a, b, c' gives 'a', 'b', 'c'; off it gives 'a', ' b', ' c', and the leading spaces travel into whatever reads the list. |
| remove_empty | BOOLEAN | true | Whether pieces holding nothing are dropped. Two delimiters in a row produce an empty piece, which is what a trailing comma on a prompt leaves behind. Turn this off when the position of every entry matters and an empty slot has to stay a slot. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| ARRAY | ARRAY | Every piece on one wire, for Text List Get, Text List Concatenate and Text List to Text. |
| strings | STRING | The same pieces as a STRING list. Because this is a list, a node reading it runs once per piece and produces one result per piece, wire it into a sampler's prompt to render every entry in turn. Text that splits into nothing stops the prompt, because a graph cannot be run zero times. |
| count | INT | How many pieces the split produced. |