ComfyUI Node

String Concat

Sticking two strings together without losing the space

By kale4eat·Created 2 years ago·Updated 2 years ago· 7
String Concat
    • string
    s1
    s2

    The most common mistake with String Concat is assuming it adds a space between the two strings. It does not. It joins them with the precision of a machine that has never seen two words side by side: "hello" + "world" becomes "helloworld". Once you internalize that, this is the workhorse text-joining node of the whole pack.

    What it is

    String Concat takes exactly two strings, s1 and s2, and returns s1 + s2 - literal concatenation. It's the simplest possible "stick text together" node, and that's its strength. Build prompts from parts ("subject" + ", " + "style"), assemble filenames from fragments, or tack a fixed suffix onto a dynamic string before it goes anywhere downstream.

    It's also chainable. Wire the string output of one Concat into the s1 of another and you can join three, four, five pieces. For a one-off workflow that beats dragging out a whole template system.

    The inputs and outputs

    Only two inputs, and the second one is where people trip:

    • s1 (STRING) - first piece.
    • s2 (STRING) - second piece. No separator is inserted, so if you want a space, comma, or newline between them, make it part of one of the strings: "a" + ", " + "b".
    • string (STRING) - the result, ready for CLIP Text Encode or anything else that eats text.

    That's the entire schema. There are no options, no modes.

    How to install it

    Same as every node in this pack - it's one tiny repo with no dependencies:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kale4eat/ComfyUI-string-util
    

    Or use ComfyUI Manager and search "ComfyUI-string-util". Restart ComfyUI, and the whole string-util category appears in the node menu.

    Common issues

    The separator thing is 90% of the pain here. "best" + "quality" gives you "bestquality", and if you're feeding that straight into a prompt encoder you'll get a word the model doesn't know. Always budget for the space or comma explicitly.

    Second gotcha: if either side is an empty string, you get the other side verbatim - which is fine, but it means a half-built prompt won't loudly fail, it'll quietly produce something malformed. If you find yourself concat-ing more than a couple of pieces, look at String Join in the same pack instead - it takes a whole list and one separator, which is a cleaner fit for "many parts, same glue."

    Categorystring-util

    Inputs (2)

    NameTypeDefaultDescription
    s1STRING
    s2STRING

    Outputs (1)

    NameTypeDescription
    stringSTRING