Nodes/comfyui-zeug/Split String to List
ComfyUI Node

Split String to List

Turning one text blob into a list you can actually iterate

By adrianschubek·Created about a year ago·Updated about a year ago· 1
Split String to List
    • strings
    text
    delimiter,
    strip_whitespacetrue

    Half the list-workflows in ComfyUI start the same way: a big block of text - comma-separated tags, newline-separated prompts, CSV-ish data - and you need to get at the individual pieces. ZeugSplitStrList cuts a string up on a delimiter and hands you a real list, which is the difference between one giant prompt and a batch of distinct ones.

    What it is

    ZeugSplitStrList lives in the zeug → Transform menu. Three inputs: text (a STRING, multiline, default empty), delimiter (a STRING, default ","), and strip_whitespace (a BOOLEAN, default on). One output, strings, which is a list of STRINGs.

    Give it "cat, dog, fox" with "," and it outputs ["cat", "dog", "fox"] - and because whitespace stripping defaults to on, you don't have to fight the stray spaces after your commas.

    When you'd reach for it

    • Splitting a comma-separated tag string into individual tags so each can be processed, switched on, or fed into a batch.
    • Turning a newline-separated list of prompts into a list you can iterate over per-frame or per-batch.
    • Pre-processing data that arrived as a single string (metadata, filenames, imported lists) into usable structured pieces.

    It's the input side of the pack's list story - split here, work on the list, and if you need a single string again, rejoin with ZeugJoinStrList. That split/rejoin pair is a legitimately handy text pipeline for delimited data.

    How it works

    The implementation is exactly what it sounds like: text.split(delimiter), optionally stripping each piece (part.strip()). Two behaviors worth knowing:

    • Empty text → empty list. If text is empty, the node returns [] rather than [""]. That's usually what you want, but it means a "blank string" and "no string" are indistinguishable downstream.
    • No delimiter found → one-element list. If "catdog" arrives with a "," delimiter, you get ["catdog"]. Splitting doesn't fail; it just doesn't split.

    The output is a genuine list on the wire (the node declares OUTPUT_IS_LIST), so it will drive nodes that iterate over inputs - feed a batch-aware node and ComfyUI will run it once per element.

    How to install it

    Ships in comfyui-zeug (German for "gear" or "stuff"), a small GPL-3.0 pack by Adrian Schubek:

    • ComfyUI Manager: search zeug in the Custom Nodes Manager, install ComfyUI-Zeug.
    • Manual:
    cd ComfyUI/custom_nodes
    git clone https://github.com/adrianschubek/comfyui-zeug
    

    Restart ComfyUI. Zero dependencies, no model downloads - the pack only uses torch and ComfyUI's own modules.

    Common issues

    The most common surprise is the whitespace default. strip_whitespace is on by default, which is great for comma-separated tags - but if you split on a delimiter where whitespace matters (say, a sentence with spaces you want to preserve), turn it off or your pieces come back stripped. Second, remember the split is literal: a multiline string split on "," will keep its newlines inside the pieces unless you strip them. If the newlines are your real delimiter, set the delimiter to a newline instead.

    For turning a text blob into iterable pieces, this is the boring, reliable tool - and in a graph, "boring" is high praise.

    Categoryzeug/transform

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    delimiterSTRING,
    strip_whitespaceBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    stringsSTRING