Text Splitter
Turning a comma string into a list you can actually use
- text_list
- count
Text Splitter cuts a string into pieces at a delimiter and hands you a real list plus the element count. In ComfyUI that's a genuinely useful trick, because a huge amount of data travels around as plain text - tag lists pasted from CivitAI, CSV-ish exports, comma-separated prompt components, coordinates - and nearly everything downstream wants a LIST, not a string.
The workflow pattern is usually: a text node or file loader gives you "apple, banana, orange", Text Splitter turns it into ["apple", "banana", "orange"], and then the list flows into Get List Item, List Info, a shuffler, or a loop. It's also the natural front-end for processing pipeline tags one at a time. You get two outputs for the trouble: the list itself and an integer count, which is handy for "how many tags did we get?" conditionals.
How it works
It's Python's str.split unless you flip the is_regex toggle, in which case it uses re.split. The regex option sounds fancy but it's mostly for multi-character or alternation delimiters (like splitting on ", " or " or " in one go). Nice touch: if you feed it a broken regex, it silently falls back to a plain split instead of erroring.
Two cleanliness toggles are on by default and worth understanding:
strip_whitespace- trims each piece, so"apple, banana"yields"apple"not" banana".remove_empty- drops empty strings, so"apple,,orange"yields two items, not three.
The inputs that matter
text- what you're splitting.delimiter- the character(s) to split on, default,.is_regex- treat the delimiter as a regex pattern. Off by default.strip_whitespace/remove_empty- the cleanup toggles above. Both default on.
Outputs: text_list (LIST) and count (INT).
Installation
Install the pack via ComfyUI Manager (search "DebugPadawan's ComfyUI Essentials"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git
Restart ComfyUI afterward. No models to download; this node is plain Python string handling. (The pack's numpy/torch/opencv requirements serve its image and math nodes - nothing to do with this one.)
Gotchas
The main thing to watch is remove_empty. For splitting CSV-style data where empty fields are meaningful, it being on by default silently deletes them - "apple,,orange" coming back as a two-item list has bitten more than one person. If you need to preserve field position, turn it off.
The other gotcha is subtler and lives in the wildcard/tag world: this node splits on the literal delimiter, so a trailing comma on a pasted tag list creates a trailing empty string that remove_empty then hides. Great when you want it hidden, surprising when you counted on item counts matching visually. If count ever looks one off, that's almost always why. Small pack, no community lore to lean on here - test with a tiny string and you'll see the behavior in seconds.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | apple,banana,orange | — |
| delimiter | STRING | , | — |
| is_regex | BOOLEAN | false | — |
| strip_whitespaceopt | BOOLEAN | true | — |
| remove_emptyopt | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text_list | LIST | — |
| count | INT | — |