Nodes/ComfyUI 1hewNodes/String Join Multi
ComfyUI Node

String Join Multi

Assemble multi-part prompts without the 'seams' showing

By 1hew·Created about a year ago·Updated 7 days ago· 33
String Join Multi
    • string
    text1
    text2
    text3
    text4
    text5
    filter_empty_linefalse
    filter_commentfalse
    separator\n
    input

    Prompt-building in ComfyUI has a dirty secret: it's all string concatenation, and the stock Text Concatenate node gets clumsy the moment you want separators, conditional blocks, or comments in your prompt file. String Join Multi joins up to five text blocks into one string with real control - a chosen separator, optional comment stripping, empty-line filtering, and {input} substitution. It's the "clean prompt assembly" node, and if you work with template-style prompts it'll quietly become a staple.

    How it works

    Each of the five text blocks is processed independently, then joined:

    • text1…text5 - multiline text blocks. Empty ones are skipped (unless you need them, see below).
    • input - a value that replaces every literal {input} placeholder across all blocks. Wire a filename, a user prompt, a seed - the template updates everywhere at once.
    • separator - what goes between blocks. Default is a newline (\n), but escape sequences work, and composite separators like \n---\n produce a tidy visual divider. The escaping is literal-aware: type \n and you get a newline, not the characters.
    • filter_comment - strips # line comments and whole """ / ''' triple-quoted comment blocks. This is for prompt files with notes in them.
    • filter_empty_line - drops blank lines. false preserves them (including intentionally empty blocks).

    Output is a single string. It's straightforward, and that's the point - the value is in doing four text chores in one node instead of a chain of four.

    Install

    Part of ComfyUI-1hewNodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/1hew/ComfyUI-1hewNodes
    

    Restart ComfyUI. Pure string handling - no models, no downloads.

    Where it fits

    The workflow pattern that clicks with this node: a "quality boost" section you toggle, a negative-prompt block with commented-out alternatives, and a variable injected via input. Join them with \n---\n, feed the result to your text encoder, and your prompt file stays readable instead of becoming one 400-character run-on line. Same pack's String Filter does the cleanup half standalone if you don't need the join.

    Common issues

    • Placeholder literally says {input} - the substitution only happens for the literal token {input}. If you use a different name, it won't match. Check your casing and braces.
    • Blocks went missing - non-empty processed blocks are skipped from the join. If filter_comment turned your whole block into comments, you get nothing. That's expected; set filter_empty_line=false to keep empty blocks in.
    • Unclosed triple quotes - filter_comment swallows everything after an unterminated """. Close your comment blocks.

    One light note: this node's sibling Multi String Join in the same pack does the same job with a dynamic number of inputs. Use the fixed-five String Join Multi when your structure is stable, and the multi-input one when the block count changes between workflows.

    Category1hewNodes/text

    Inputs (9)

    NameTypeDefaultDescription
    text1STRING
    text2STRING
    text3STRING
    text4STRING
    text5STRING
    filter_empty_lineBOOLEANfalse
    filter_commentBOOLEANfalse
    separatorSTRING\n
    inputSTRING

    Outputs (1)

    NameTypeDescription
    stringSTRING