String Splitter
Turn One Blob of Text Into a Real List
- string_list
You have a text box full of comma-separated things - ten prompt candidates, a list of LoRA names, a batch of seeds you pasted from somewhere - and you want each one as its own item you can index into or loop over. That's the entire job of the String Splitter. No API, no model, no state. It's a text-format utility, and it does its one job without fuss.
How it works
The mechanism is what you'd hope: take the text, cut it on the delimiter, hand back a list. Two details make it friendlier than rolling your own Python in a script node:
- It understands escaped delimiters. Type
\nor\tinto the delimiter field and it converts them to a real newline or tab before splitting. So you can split a multi-line prompt block into individual prompts by setting the delimiter to\n. - It strips whitespace off each item. That means
"red, green , blue "becomes["red", "green", "blue"]- no stray spaces poisoning your downstream nodes.
Inputs and output
text(STRING, multiline) - the blob to split.delimiter(STRING, default,) - what to cut on,\nand\tsupported.- Output:
string_list- aSTRINGlist, which is the key bit. This is a real list socket, so it plugs into anything that consumes a list of strings, like the pack's own Any List Selector or an iterator that steps an index across a batch.
Install
Standard pack install: ComfyUI Manager → "Sagado Nodes for ComfyUI", or
cd ComfyUI/custom_nodes
git clone https://github.com/5agado/ComfyUI-Sagado-Nodes
pip install -r ComfyUI-Sagado-Nodes/requirements.txt
Restart, done. No models, no extra dependencies - this one's pure Python stdlib plus the pack's base requirements.
Where people trip
The classic gotcha: your text genuinely contains the literal characters \n (backslash-n, two characters) and you actually want to split on a comma - no, that's fine, it only converts when your delimiter field itself is \n. The real trip is forgetting that empty chunks survive the split. Paste a trailing comma and you'll get an empty string at the end of your list, which then feeds an empty prompt or an empty filename into whatever's downstream. Check the list output once in a debug/Show Text node if something looks one item off.
It's boring, dependable plumbing - which is precisely why it keeps showing up in real workflows.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| delimiter | STRING | , | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string_list | STRING | — |