ComfyUI Node

Concat Strings

Concat Strings puts a newline where you expected a space — and that's the point

By mullakhmetov·Created 2 years ago·Updated 2 years ago· 0
Concat Strings
    • STRING
    string_a
    string_b

    Most "combine two strings" nodes glue them together with a space or nothing, and you find yourself hunting for a separator option that doesn't exist. Concat Strings from mullakhmetov's comfyui_dynamic_util_nodes pack doesn't bother with any of that: it takes two strings and joins them with a newline, full stop. No separator parameter, no cleverness. Once you get why, it's actually a handy little thing for building multi-line prompts.

    What it's for

    The one-liner in the project metadata says these nodes were written for "dynamic workflows" - the kind where the graph assembles its own prompts from parts instead of you typing a whole prompt in a box. That's this node's lane. You stack a base prompt block, a style block, a negative-prompt fragment, and each one lands on its own line, the way ComfyUI's own prompt text boxes do. Feed it into a CLIP Text Encode and the newlines read just like hand-typed ones.

    How it works

    The whole implementation is three lines:

    result = "\n".join([string_a, string_b])
    return {"ui": {"text": (result,)}, "result": (result,)}
    

    It joins string_a and string_b with a newline, shows the result in a UI panel (it's both an input and an output node), and passes it down the wire. Note what's not there: no separator argument, no trimming, no "ignore empty strings" logic. If one input is empty you get a leading or trailing blank line. It's brutally honest code, which means its behavior is easy to predict.

    Inputs and outputs

    • string_a (STRING) - first block. Defaults to empty.
    • string_b (STRING) - second block. Defaults to empty.

    Both are forceInput, so like String Output in the same pack, there are no text boxes - you can't type into this node. You wire in upstream string sources. The single output is STRING, and it's one string, not a list.

    That newline default is the one thing to keep in your head. If you reached for this node to build a file path like dir/file.jpg, you'll get dir\nfile.jpg, and nothing will load. For that job you want the pack's Format String node (which does Python-style {var} substitution) or any path-builder. Concat Strings is for stacking text blocks, not gluing fragments.

    Installing it

    No requirements.txt, no models, nothing heavy - the code uses only Python's stdlib plus what ComfyUI already ships.

    • ComfyUI Manager: search comfyui_dynamic_util_nodes, install, restart.
    • Manual:
      cd ComfyUI/custom_nodes
      git clone https://github.com/mullakhmetov/comfyui_dynamic_util_nodes
      
      Restart ComfyUI after cloning.

    The README is effectively empty, so treat the source as the documentation - it's short enough to read in a minute.

    Where people get tripped up

    • "My output has a line break I didn't ask for." That's the design, not a bug. The newline is unconditional, so if you want AB you're looking at the wrong node.
    • "I can't type into it." Right - both inputs are pure sockets. Grab a string source node from any text pack and wire it in.
    • It only takes two strings. If you're chaining three or four blocks, you'll nest these or reach for a pack with a multi-line textbox. For the two-piece job it's the smallest thing that works.

    It's a one-trick node, but the trick is done well: predictable, dependency-free, and transparent about what it does.

    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    string_aSTRING
    string_bSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING