Nodes/duckcomfy personal nodes/Duck Text Concatenate
ComfyUI Node

Duck Text Concatenate

Glue prompt parts together without the stray commas

By duckcomfy·Created about a year ago·Updated 10 months ago· 0
Duck Text Concatenate
    • STRING
    delimiter,
    clean_whitespace
    text_a
    text_b
    text_c
    text_d

    Duck Text Concatenate joins up to four text strings into one, with a separator of your choice, and it's smart about the two things that usually make concatenation ugly: it skips empty inputs, and it can strip stray whitespace. So if one branch of your graph is "off," the output stays clean instead of becoming "portrait, , , sunset".

    This is the "assemble a prompt from parts" node. You keep a base style tag block, a character block, and a lighting block in separate text nodes (or separate branches of the graph), merge them here with ", " as the delimiter, and feed the result to a text-to-conditioning node. Because empty inputs are dropped, you can wire in optional blocks - an extra LoRA trigger phrase, a quality booster - and just leave them unwired when you don't want them; the join still comes out right.

    The inputs that matter

    • delimiter - the separator, default ", ". This is the one you'll actually set. If you want tags on separate lines, type \n and the node treats it as a literal newline.
    • clean_whitespace - true/false. When on, each input is stripped of leading/trailing whitespace before joining, and truly empty inputs are skipped. Leave it on; it's the thing that saves you from the double-comma mess.
    • text_a through text_d - optional STRING inputs, any subset can be connected.

    Output is a single STRING with the parts joined. Wire it into a Duck_Text_to_Conditioning (same pack) or any CLIP encoder.

    What it's not

    It's a simple text join - it does not sort, dedupe, or interpret weights. And note the one behavioral quirk the code is explicit about: if clean_whitespace is off, an input that is all whitespace counts as "non-empty" and gets concatenated in, because the skip test only checks for the empty string. Keep clean_whitespace on unless you have a reason not to.

    Install

    Part of duckcomfy personal nodes. ComfyUI Manager → search "duckcomfy personal nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/duckcomfy/duckcomfy_personal_nodes
    

    Restart ComfyUI. No pip dependencies, no model downloads. Like much of this pack, the node is lifted from the WAS Node Suite (the source class is literally WAS_Text_Concatenate); the author copied it in to cut dependency count and update risk. The behavior is proven, which is the good kind of "plundered."

    Gotchas

    The \n handling is the common gotcha: the delimiter accepts a literal newline OR the two characters backslash-n, and both produce a newline. If you type \n expecting the literal two characters in your output, you'll be surprised. Also remember the four inputs are optional - the node happily returns an empty string if you connect none, which then flows downstream as an empty prompt. An empty prompt is a valid (if useless) thing in ComfyUI, so it won't error - it'll just produce garbage or nothing, depending on what you feed it into.

    Categoryduckcomfy

    Inputs (6)

    NameTypeDefaultDescription
    delimiterSTRING,
    clean_whitespaceCOMBO2 options: true, false
    text_aoptSTRING
    text_boptSTRING
    text_coptSTRING
    text_doptSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING