FB String Split
Cut one long string into a list you can actually use
- STRING_LIST
FB String Split does one thing and does it cleanly: it takes a string, cuts it on a delimiter, and hands you a STRING_LIST. That sounds like a school-exercise utility until you have a CSV of prompts, a pipe-delimited prompt, or a filename you need to pull apart - then it's the node that turns text into something a loop can iterate.
The pack's own FB Multiline String List splits on newlines; this node splits on whatever you say, which makes it the more flexible of the two.
How it works
The mechanism is Python's str.split(delimiter) - every occurrence of the delimiter cuts the string, and the pieces become list items. The one genuinely clever bit is the delimiter_as_raw_str flag:
- delimiter_as_raw_str off (default) - the delimiter is decoded as a Python unicode-escape sequence first. Type
\nin the field and you're splitting on real newlines even though it's a single-line box.\tgives tabs,\|gives a literal pipe. - delimiter_as_raw_str on - the delimiter is used exactly as typed. Only reach for this when your delimiter is actually a backslash sequence.
Inputs and outputs
- value - the string to split (multiline box, so you can paste a block).
- delimiter - the separator, default
,. - delimiter_as_raw_str - whether to interpret escape sequences in the delimiter.
- STRING_LIST - the pieces, in order.
Where it fits
Prompt variation is the headline use: split a comma-separated list of prompts into items and feed the list to a batch loop, same idea the KB's prompt-engineering notes cover for wildcard-style batching but with explicit items. Splitting on | for alternating prompt parts, or breaking a filename on _ to get at its components, both work with a one-character delimiter change.
It round-trips with the pack's FB String Join - split, reshape, join back with a different delimiter - and it feeds naturally into any node that consumes a STRING_LIST.
Gotchas
- Empty segments are kept.
a,,bsplit on,gives["a", "", "b"]. Sometimes that's exactly right (preserving position); sometimes it's a surprise empty item. If it bites you, filter or chain into a strip. - No trimming.
" a"stays" a"- the space is preserved in the item. Pair with FB String Strip if you need clean items. - Splits on every occurrence, not just the first. If you wanted
split(..., maxsplit=1)-style behavior, this isn't the node for it.
Install
Same as the rest of the pack - no dependencies, no models, just the clone:
cd ComfyUI/custom_nodes
git clone https://github.com/FredBill1/comfyui-fb-utils
Restart ComfyUI and it appears under the FredBill1 category (or install via ComfyUI Manager, searching comfyui-fb-utils). The entire pack is Python standard library - no requirements.txt, no pip step, nothing that can break your environment. The README is a single line; the split logic is a few lines of source if you want to confirm exactly how the delimiter flag behaves.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| value | STRING | — | |
| delimiter | STRING | , | — |
| delimiter_as_raw_str | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING_LIST | STRING_LIST | — |