Nodes/Link Comfy Nodes/Concat Strings
ComfyUI Node

Concat Strings

Template-based text building with %1, %2 placeholders

By Mister-Link·Created 9 months ago·Updated 23 days ago· 0
Concat Strings
    • STRING
    template%1 %2
    string1
    string2
    string3
    string4
    string5
    string6
    string7
    string8

    Most string-concatenation nodes in ComfyUI give you an ordered chain - string A then string B then string C - which is fine until you need something in a specific shape, like "{name}_v{version}.png" where the pieces don't all belong in a straight line. Concat Strings solves that with a template: you write out exactly how the final string should look using %1, %2, and so on as placeholders, and wire your actual string values into the matching slots.

    How it works

    The template field is the whole point - it's plain text with numbered placeholders dropped in wherever a dynamic value should go. The node substitutes each %N with whatever's connected to the matching stringN input, and outputs the assembled result. Unconnected placeholders just resolve to empty string (every stringN input defaults to ""), so you don't need to wire all eight if your template only uses two or three.

    The inputs and outputs that matter

    • template (STRING, required, multiline, default "%1 %2") - your pattern. This is what you actually edit; everything else just fills in the blanks.
    • string1 through string8 (STRING, all optional) - up to eight values you can reference as %1%8 inside the template. Use as many or as few as your template needs.

    One output: STRING - the assembled result, ready to feed into a save path, a filename prefix, a text overlay, or anywhere else in your graph that wants a single string.

    How to install it

    Via ComfyUI Manager: search "Link Comfy Nodes," install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Mister-Link/link-comfy-nodes
    pip install -r link-comfy-nodes/requirements.txt
    

    Restart ComfyUI. This is a plain text utility node - no dependencies to speak of beyond the pack's shared requirements.

    Common issues & troubleshooting

    Placeholder number doesn't match the input you wired. It's an easy typo - writing %3 in the template but plugging your value into string2. Since a mismatch doesn't error, it just silently leaves the intended placeholder empty (or substitutes the wrong value if you've got two placeholders swapped), so a blank spot in your output is usually a numbering mismatch, not a missing connection.

    Wanting more than 8 slots. The node caps at string1string8. If you genuinely need more dynamic pieces than that, either pre-combine some values with a separate concatenation step before feeding them in, or chain two Concat Strings nodes together - one to build a sub-string, a second to fold that sub-string into a larger template.

    Literal % characters in your template getting swallowed. Since % is the placeholder marker, using it for anything else in the template text (a literal percent sign in your output) can conflict with the substitution logic. If you need a literal percent sign in the result, build it via one of the connected string inputs rather than typing it directly into the template.

    Categoryutils

    Inputs (9)

    NameTypeDefaultDescription
    templateSTRING%1 %2
    string1optSTRING
    string2optSTRING
    string3optSTRING
    string4optSTRING
    string5optSTRING
    string6optSTRING
    string7optSTRING
    string8optSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING