Nodes/ComfyUI Assistant Node/PVL Split String
ComfyUI Node

PVL Split String

One string in, up to six strings out

By pvlprk·Created about a year ago·Updated 8 months ago· 1
PVL Split String
    • string_1
    • string_2
    • string_3
    • string_4
    • string_5
    • string_6
    texttext
    delimiter[*]

    Strings arrive in ComfyUI in clumps - a CSV row, a comma-separated list of LoRA names, a prompt built from several parts, an API response that dumped multiple values into one text field. PVL Split String is the knife: it cuts one string on a delimiter and hands you up to six separate STRING outputs.

    It comes from pvlprk/comfyui-pvl-api-nodes ("ComfyUI Assistant Node"), and it's part of the pack's small string toolkit - the same family as the String Concat nodes and the String List converters. If you deal with generated or API-produced text at all, you'll hit a use for it.

    How it works

    Mechanically it's text.split(delimiter) with a bit of housekeeping:

    • text - the input string.
    • delimiter - what to cut on, default [*]. Notice the pack leans on bracketed delimiters ([*], [++]) across its string nodes - that's a deliberate convention so that ordinary commas or pipes in your content don't accidentally split it. The downside: you have to type the magic token.
    • Outputs string_1 through string_6. Parts are whitespace-stripped; if the input has fewer than six pieces, the unused outputs are empty strings. If the delimiter is empty, no split happens - the whole string lands in string_1.

    So "red[*]green[*]blue" becomes red, green, blue and three empties. Trimmed, ready to feed.

    What you'd do with it

    The most common flow is unpacking a packed value. Say an upstream node (an API call, a workflow parameter, a wildcard) gives you one text field containing multiple tokens - split them into slots, then route each slot to a different consumer: one into a prompt, one into a filename, one into a save condition. It's also handy for turning a "list" that arrived as a flat string into something the String-List nodes or a per-item loop can chew on.

    Because the outputs are fixed slots rather than a variable-length list, think of it as "up to six named wires out" rather than "a list out". If you need an actual list, the pack's PVL String To String List is the better fit; this node is for when you want named, individual strings to wire into specific places.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/pvlprk/comfyui-pvl-api-nodes
    

    restart, or install via ComfyUI Manager (search "ComfyUI Assistant Node"). No models, no dependencies beyond Python's built-in string handling.

    The gotchas

    • Only the first six parts survive. A seventh piece is silently dropped, and the six slots still fill. If your input has more than six tokens, chunk it upstream first.
    • Bracket delimiters are exact. "[*]" is the default - if you switch to a comma, remember commas inside your content (like "dog, cat, mouse" as a single item) will split too. The brackets exist to avoid exactly that.
    • Whitespace is stripped, which is almost always what you want - but if a token's leading/trailing spaces matter, this node isn't for you.
    CategoryPVL_Utils

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGtext
    delimiteroptSTRING[*]

    Outputs (6)

    NameTypeDescription
    string_1STRING
    string_2STRING
    string_3STRING
    string_4STRING
    string_5STRING
    string_6STRING