ComfyUI Node

Combine String

Two strings in, one string out — with a custom separator

By HavocsCall·Created 2 years ago·Updated 9 months ago· 4
Combine String
    • Combined_String
    String_1
    String_2
    Separator

    Combine String takes two strings and a separator and merges them into one. Yes, that's the whole node. But the separator detail - and the fact that empty strings get skipped - makes it just flexible enough to be genuinely useful for building prompts from parts.

    Why you'd use it

    Prompt construction in ComfyUI gets messy fast when you're assembling text from multiple sources: a fixed base prompt, a wildcard, a dynamically generated tag. Combine String lets you stitch two pieces together with whatever joins them - a comma, a space, a newline. The separator is its party trick. Want masterpiece, best quality glued to your subject with a comma? Separator , and you're done. Want two lines joined with a newline for a multi-line prompt? Separator \n does it.

    It's the minimal building block of a modular prompt system: keep each part in its own Text Box, combine them in stages, and you can swap parts without editing a giant prompt blob. It's not fancy, but it composes.

    How it works

    The implementation is a compact join that skips empties:

    parts = [part for part in [String_1, String_2] if part]
    combined = Separator.join(parts)
    

    Inputs:

    • String_1, String_2 - both are forceInput sockets, so wire them from Text Box nodes or anything that emits a STRING. No typing inline.
    • Separator - the glue. Defaults to empty string, which just concatenates.

    Output:

    • Combined_String - the joined result, ready for a CLIPTextEncode or another Combine String (they chain nicely).

    The empty-string-skip is worth knowing: if one side is empty, you get just the other side, not a dangling separator. That's what makes it safe to use with inputs that are sometimes blank - like optional wildcard slots.

    Where people get burned

    The forceInput behavior trips people up: these aren't editable text boxes, they're input ports, so you must have something wired in. And since only two strings are supported, longer compositions mean chaining multiple Combine String nodes - at which point you might honestly prefer a Prompt Combiner (this same pack has one with seven named slots) if your prompt has more than two parts.

    Also note the separator is literal text - , is comma-space, \n is a newline if your node value actually contains one. Don't expect smart punctuation handling; this node joins, it doesn't punctuate.

    Installing it

    ComfyUI Manager → search "HavocsCall" → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/HavocsCall/comfyui_HavocsCall_Custom_Nodes
    

    Restart, under HavocsCall/Combination. No requirements.txt, no model downloads - instant install.

    CategoryHavocsCall/Combination

    Inputs (3)

    NameTypeDefaultDescription
    String_1STRING
    String_2STRING
    SeparatorSTRING

    Outputs (1)

    NameTypeDescription
    Combined_StringSTRING