String Splitter
Split one ComfyUI string into a real list (and get a count for free)
- parts
- count
ComfyUI hands you one big STRING almost everywhere. Prompt text, tag lists, CSV rows, filename batches - it all arrives as a single blob. But the nodes that actually do work - loop over batches, iterate a list, build per-entry filenames - want a list of strings. That's the gap AutoFlowStringSplit (shown as "String Splitter") fills: it chops one string into parts by a delimiter and hands you the count as a bonus.
It's dead simple under the hood. The node calls Python's str.split(), splitting text on delimiter, then strips whitespace off every part. So a, b , c becomes ["a", "b", "c"], not ["a", " b ", " c"] - the cleanup saves you a headache downstream.
Three inputs, and you only really set the first two:
text- the string to split. Multiline, so paste a whole block in.delimiter- default,. It's literal text, not a regex.max_splits- default-1, and the tooltip says it all: "Maximum number of splits, -1 for unlimited."
Outputs: parts (a STRING list) and count (an INT - how many parts came out).
Where people get burned:
max_splitscounts splits, not parts. Python semantics:max_splits=1gives you two parts,max_splits=3gives four. If you want "at most N parts," set it to N-1.- Empty strings survive.
"a,,b"with","gives["a", "", "b"]- three parts, one of them empty, andcountincludes it. If empty parts break whatever you're feeding, clean the text first. - It's not a regex splitter. The delimiter is matched literally, so
\s+won't behave the way you hope. For regex splitting, reach for a dedicated regex node instead.
What to wire it into
parts feeds any node that accepts a STRING list - list indexers, batch/loop iterators, or just a text-list display to eyeball the result. count is the sleeper output: feed it into an INT-driven batch range or a conditional so your workflow runs once per part. If you're turning a tag string into per-tag operations or splitting CSV-ish data, this is the node you'd reach for - small, predictable, no surprises.
Install
This is part of the ComfyUI-AutoFlow pack, so installation is pack-wide. Fastest route is ComfyUI Manager - search ComfyUI-AutoFlow, install, restart. Or clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ZXL-Xinram/ComfyUI-AutoFlow
Then restart ComfyUI. The nodes land under the AutoFlow category in the menu. There's no requirements.txt and nothing to download - this node is pure Python stdlib, and the pack's heavier imports (torch, numpy, Pillow, opencv-python for its video nodes) all ship with a stock ComfyUI. One pack-wide quirk: the video nodes import OpenCV at load time, so if your Python env is somehow missing opencv-python, the entire pack fails to register - this node included. In practice that never happens on a normal ComfyUI install.
Troubleshooting
If parts comes back empty, your delimiter doesn't appear in the text - a comma won't split on tabs or spaces. If count looks higher than expected, remember it counts every split segment, including empty ones. And if max_splits seems to produce one more part than you asked for, that's Python's split semantics doing their job, not a bug.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| delimiter | STRING | , | — |
| max_splits | INT | -1-1–100 | Maximum number of splits, -1 for unlimited |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| parts | STRING | — |
| count | INT | — |