Nodes/oshtz Nodes/String Splitter
ComfyUI Node

String Splitter

When One Text Box Just Isn't Enough

By oshtz·Created 2 years ago·Updated 2 months ago· 6
String Splitter
    • output_1
    • output_2
    • output_3
    • output_4
    • output_5
    • output_6
    • output_7
    • output_8
    • output_9
    • output_10
    input_string
    separator,

    String Splitter does one thing: takes a text blob, splits it on a separator, and fans it out across up to ten separate outputs. It's the kind of node you don't think about until you're neck-deep in a workflow that needs to turn a list into individual wires - then it's suddenly indispensable.

    The classic use is text-driven generation. You've got a list of prompts - comma-separated, one per line, whatever - either typed by hand or spat out by an LLM node, and you want each one as its own string so you can run them through a batch loop or compare outputs. ComfyUI's own text widgets handle a single string nicely; splitting that string apart is where a tiny helper like this earns its keep.

    How it works

    Under the hood it's a plain Python str.split() with a padding safety net:

    parts = input_string.split(separator)
    outputs = parts[:10] + [''] * (10 - len(parts))
    return tuple(outputs)
    

    That's the whole thing. Split on the separator, keep up to the first ten pieces, and pad any unused outputs with an empty string so the node always returns all ten slots. Nothing clever, nothing hidden.

    The inputs and outputs that matter

    • input_string (STRING, multiline) - the text you want to chop up.
    • separator (STRING, default ,) - what to split on. A comma, a newline, a pipe, whatever your list uses.

    Outputs are output_1 through output_10, all STRING. Wire each into whatever needs a single prompt or text value. If your list has fewer than ten items, the leftover outputs are just empty strings - harmless, and easy to ignore.

    Where people get burned

    Two gotchas, both from the fact that this is a literal split with no cleanup:

    • Whitespace isn't trimmed. Split "red, blue, green" on a comma and you get " red", " blue", " green" - leading spaces included. If that matters downstream, either split on ", " (comma plus space) or trim in a text-processing node.
    • Anything past the tenth item is silently dropped. No warning, no error, the eleventh piece just doesn't exist. If you're feeding it a long list, count your items or check the outputs before you trust them.

    Both are easy to work around once you know they exist, but they're the kind of thing that costs you an hour of "why is my prompt wrong" otherwise.

    Installing it

    String Splitter is one node in the oshtz Nodes pack, so you get it with the rest - same install for all of them. In ComfyUI Manager, search "oshtz". Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/oshtz/ComfyUI-oshtz-nodes.git
    cd ComfyUI-oshtz-nodes
    pip install -r requirements.txt
    

    Then restart ComfyUI. The pack's dependencies are just requests, pydantic, Pillow, and numpy - no models, no keys.

    Should you reach for it?

    If you need a list as a list - say, feeding many items into a batch-capable node - a node that outputs a true LIST type is a better fit, because this one locks you at ten fixed outputs. But tons of ComfyUI nodes only accept a single STRING, and that's exactly the gap String Splitter fills. For turning a comma-separated list into discrete channels you can route around the graph, it's a clean, boring, dependable little tool - and sometimes boring is exactly what you want.

    Categoryoshtz Nodes

    Inputs (2)

    NameTypeDefaultDescription
    input_stringSTRING
    separatorSTRING,

    Outputs (10)

    NameTypeDescription
    output_1STRING
    output_2STRING
    output_3STRING
    output_4STRING
    output_5STRING
    output_6STRING
    output_7STRING
    output_8STRING
    output_9STRING
    output_10STRING