Nodes/Preset Dimensions/String Concat modusCell
ComfyUI Node

String Concat modusCell

Two strings in, one string out — with a comma you didn't ask for

By modusCell·Created 3 years ago·Updated 2 years ago· 2
String Concat modusCell
    • STRING
    string_1
    string_2

    String Concat modusCell is a two-line utility hiding in a dimension pack. It takes two strings, joins them, and hands you the result. That's it. But "joins them" has a catch that's going to surprise you the first time, and it's worth knowing before you build anything on top of it.

    Why you'd reach for it

    String handling in ComfyUI is surprisingly annoying. You can hardcode a prompt or a filename in a text widget, but the moment you want to combine strings - a base prompt plus a per-batch variation, a file prefix plus a date, a wildcard result plus a suffix - you need a node that does concatenation, and base ComfyUI doesn't ship one. That's the gap this node fills: string_1 and string_2 in, one STRING out, ready to feed a CLIP Text Encode, a filename, whatever.

    How it works - and the gotcha

    Here's the thing nobody tells you: it doesn't just glue the strings together. The code returns f'{string_1}, {string_2}' - that's a comma and a space inserted between the two inputs. So "a dog" and "in a park" becomes "a dog, in a park", not "a dogin a park". That's actually a thoughtful default for building prompts, where you usually want the comma anyway. It's a trap when you're assembling filenames or other punctuation-sensitive text, because you'll get a surprise comma you never typed.

    The related trap: if either input is empty, you get a leading or trailing ", " - an empty string_1 yields ", in a park". Neither input is multiline (both are plain single-line STRING fields, defaulting to empty), so you're not pasting a wall of text in here. None of this is documented in the README, which just calls the pack "simple node for sharing latent image size" and doesn't mention this node at all.

    What you'd wire it into

    Output is one STRING. Feed it straight into a CLIP Text Encode alongside your positive prompt, chain two of these to build longer strings, or route the result into a filename node for saving. If your workflow already carries the rgthree pack, its Power Puter can evaluate string expressions mid-graph and might be the more flexible option - but that's a bigger install for a niche need. For one simple join, this is fine.

    How to install

    Same as the rest of the pack, and there's nothing heavy anywhere in it:

    • ComfyUI Manager - search the pack title Preset Dimensions.
    • Manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/modusCell/ComfyUI-dimension-node-modusCell
    

    Restart ComfyUI and search "String Concat" in the node menu - it shows up under its full class name with the modusCell suffix. The pack has no dependencies, no models, and hasn't been touched since a single December 2023 commit, so nothing here will break your environment.

    Common issues

    The comma behavior is the whole list, honestly - people build a filename, get a ", ", and think the node is broken. It's not broken; it's opinionated. Work around it by trimming or by leaving the punctuation to the node when you're building prompts, where it's a feature. For a 15-line MIT-licensed utility, that's about the right amount of drama. If you only need a couple of fixed strings joined, use it and move on; if you need real string logic, reach for a proper expression node.

    Categoryconcat_string

    Inputs (2)

    NameTypeDefaultDescription
    string_1STRING
    string_2STRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING