Nodes/ComfyUI-mnemic-nodes/πŸ”— String Concat / Append
ComfyUI Node

πŸ”— String Concat / Append

Glue Strings Together Without Adding a Python Node

By MNeMoNiCuZΒ·Created 3 years agoΒ·Updated a day agoΒ· 105
πŸ”— String Concat / Append
    • concatenated_string
    β—„delimiterβ–Ί
    β—„string_0β€”β–Ί
    β—„string_1β€”β–Ί

    πŸ”— String Concat / Append joins strings with an optional separator. That's the entire job description, and it's a job ComfyUI makes you do constantly: a style tag plus a random subject plus a random lighting word, or a folder path plus a date plus a filename, or five different branch outputs collapsed into one prompt before the encoder sees them.

    The feature that makes it pleasant is that it grows. Connect the last available input and a new empty one appears; disconnect and unused trailing slots disappear. No "how many strings do I need" pre-decision, no reroute spaghetti.

    How it works

    You get string_0 and string_1 to start, and the node adds further string_N inputs as you connect - the slots are evaluated in numeric order, so the output order matches the wiring order, not the order you happened to connect them in. Any input left empty is skipped, which is the detail that makes this node good for optional branches: an unwired branch contributes nothing instead of leaving , , in your prompt.

    delimiter is inserted between every surviving piece. Leave it empty for direct concatenation (red hair + freckles β†’ red hairfreckles, which is occasionally what you want and usually not). For prompt work you want , or ; for filenames you want _ or nothing, since the pieces you're joining there usually already carry their own separators.

    Note what it does not do: no trimming of the pieces themselves, no deduplication, no escaping. Concatenating two strings that each end in a comma gives you a double comma, and nothing will warn you.

    Inputs and outputs

    Optional inputs: delimiter, string_0, string_1, plus whatever the node has grown. All string-typed, and they're forced inputs - you're expected to wire things in rather than type them (though a converted or primitive string source works fine).

    One output: concatenated_string, a STRING. It goes into a CLIP Text Encode, a Save Text File, a filename prefix, or another concat node if you've run out of room on one.

    Install

    ComfyUI Manager β†’ search "ComfyUI-mnemic-nodes" β†’ install β†’ restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes
    

    No downloads, no API keys, nothing to configure. The pack's requirements.txt installs a long list of packages for its other nodes (transformers, opencv-python, tiktoken, piexif…), but this node is plain Python.

    Common issues

    A missing comma between two phrases. Your delimiter is empty, or one branch produced an empty string and got skipped - which is usually correct behaviour and occasionally surprising. Check the intermediate strings with a display node.

    Double separators. The pieces already contain punctuation. Concat is a joiner, not a formatter; if you need the commas cleaned up, there's a String Cleaning node in the same pack.

    Order isn't what you wired. It's string_0, string_1, string_2… in order - the sockets are labelled, so read them, don't count wires from memory.

    The graph got wide. Every branch needs its own wire into this node. Past five or six inputs, a reroute or two makes the graph readable again, and the pack's Wildcard Processor might be the better tool if what you're really doing is assembling a prompt from options.

    Category⚑ MNeMiC Nodes

    Inputs (3)

    NameTypeDefaultDescription
    delimiteroptSTRINGOptional separator to insert between concatenated strings (e.g., ', ' or ' | '). Leave empty for direct concatenation.
    string_0optSTRINGString input - connect strings here. More inputs appear as you connect.
    string_1optSTRINGString input - connect strings here. More inputs appear as you connect.

    Outputs (1)

    NameTypeDescription
    concatenated_stringSTRINGEvery connected string joined with the delimiter. Empty inputs are skipped.