String to String List
A Text Box In, a Real List Out — ComfyUI's Missing String Utility
- string_list
ComfyUI is full of nodes that accept a list of strings, but getting that list from a plain text box is oddly annoying. If you paste "red, blue, green" into a standard string input you get one string with commas in it, not a list. String to String List is the three-second fix: one string in, one genuine list out, split on whatever character you choose. It's the most-viewed helper in the cg-image-filter pack for a reason - everyone eventually needs this.
It sits comfortably alongside the pack's other string helpers, but where Split String on character is tuned for the "five fixed outputs for the extras fields" workflow, this one just gives you the whole list in one output. Feed it a list of prompts, tags, filenames, or seeds and hand the result to any node that wants a batch of strings - prompt schedulers, batch loaders, caption utilities. It's the adapter that makes text boxes speak list.
How it works
Two inputs, one output - there's nothing to get lost in:
string- what you're splitting.split- the substring to cut on. Default is,. Type the literal wordlinebreakto split on newlines instead, which is the correct move for pasted multi-line text.
It splits the string on every occurrence of split, strips whitespace from each piece, and returns them as the string_list output. "apple, banana, cherry" becomes ["apple", "banana", "cherry"]. The whitespace stripping matters more than it looks: it means you can paste sloppy comma-separated text and not chase phantom spaces through your graph.
Installing it
Part of chrisgoringe/cg-image-filter, so it rides along with the filter nodes. ComfyUI Manager, search "cg-image-filter" or "Image Filter", or:
cd ComfyUI/custom_nodes
git clone https://github.com/chrisgoringe/cg-image-filter
Restart ComfyUI. No pip dependencies, no model downloads - the pack is pure Python and JavaScript.
Gotchas
Nothing exotic, but a couple of behaviors are worth knowing. Empty pieces aren't filtered - "a,,b" gives you three entries with an empty string in the middle - so if your source text is untidy, clean it before you split. And because it splits on the substring as a whole, a split value that appears inside a piece will cut there too. Use a separator that can't collide, or lean on linebreak for pasted blocks. For the five-fixed-outputs flavor of the same idea, the pack's Split String on character node is the one you want instead.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — | |
| split | STRING | , | Split on this substring (or linebreak) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string_list | STRING | — |