ComfyUI Node

Split String

One string in, twelve out — the tiny node that splits your prompt into paragraphs

By brayevalerien·Created about a year ago·Updated about a year ago· 11
Split String
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    string

    Split String is exactly what its name promises and nothing more: one multiline string goes in, up to twelve separate strings come out. There are no settings, no modes, no second widget. The README is a single line - "Very specific, for personal use" - so set expectations accordingly. This is a sharp little knife, not a Swiss army node.

    And yet it solves a genuinely annoying problem. Modern prompting - especially the block-structured style that's become the default on LLM-encoded models - treats a prompt as a series of separated paragraphs: a tag block, a scene description, a style block, a lighting block, each on its own. Plenty of workflows want to keep those blocks separate so they can be rerouted independently, sent to different text encoders, or toggled by a LoRA trigger. Split String is the tool that breaks one pasted string into those pieces without you hand-copying between nodes. It also slots into the LLM-in-ComfyUI pipeline shape, where a text-generation node emits structured blocks and you need each block as its own wire.

    How it works - and the one trap in it

    The entire mechanism is a single line of Python:

    return (*string.split("\n\n")[:12],)
    

    Read that carefully, because it's the difference between this node working and confusing the hell out of you. The split happens on blank lines (\n\n, i.e. empty lines separating paragraphs), not on every newline. The pack's own metadata calls it "splitting a string with 12 lines," which is wrong about the delimiter. Paste in a string with ordinary single newlines and no blank lines, and you get one output holding the whole thing. If you want twelve outputs, separate your blocks with empty lines.

    Two more behaviors fall out of the same line. The [:12] is a hard cap: past more than twelve blank-line-separated blocks and the extras are silently dropped. And if you feed it fewer than twelve paragraphs, the trailing outputs simply don't fill. So only wire up the outputs you actually plan to use - don't chain all twelve into a workflow and expect empty strings to flow harmlessly through every one.

    The inputs and outputs

    The input story is short. There's one required input, string (STRING) - the multiline text field you paste your paragraphs into. That's it; no optional inputs, no hidden parameters to trip over.

    The outputs are twelve, all typed STRING, numbered left to right in the order your blocks appear. Each one wires into anything that accepts a string: a CLIP Text Encode node, a Show Text / Save Text debugger, or a string input on whatever custom node you're feeding. It's plain text plumbing, so there's no type-matching drama.

    Installing it

    Nothing heavy here. There's no requirements.txt, no model downloads, no system dependencies - just pure Python stdlib, so it can't break your environment the way heavier custom nodes sometimes do. The two normal routes:

    Via ComfyUI Manager - open Manager, search for "ComfyUI-splitstring" (or the pack title "ComfyUI-splitstring"), and install.

    Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/brayevalerien/ComfyUI-SplitString
    

    Restart ComfyUI either way. The node shows up in the node menu as Split String.

    Where people get burned

    • Blank lines are the delimiter. If your text uses single newlines, the node returns one blob. This is the #1 confusion and it's an easy fix: format your input as paragraphs.
    • The twelve cap is real. Long structured prompts with more than twelve blocks lose the tail silently - count your paragraphs if something important keeps vanishing.
    • Trailing outputs can come up empty. With three paragraphs you get three filled outputs; outputs four through twelve are unfilled. Don't wire slots you can't guarantee.
    • It's a personal-use node. One author, one function, no update cadence to speak of. If it does what you need it does it forever; if it doesn't, grab a bigger text-utility pack instead of waiting for a feature.

    For a one-input, one-purpose utility, Split String is refreshingly honest: it does the one thing, does it with no dependencies, and the only thing to learn is that "split" means paragraph split.

    Categorysd

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING

    Outputs (12)

    NameTypeDescription
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING