String Join Multi
Assemble multi-part prompts without the 'seams' showing
- string
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---\nproduce a tidy visual divider. The escaping is literal-aware: type\nand 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.
falsepreserves 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_commentturned your whole block into comments, you get nothing. That's expected; setfilter_empty_line=falseto keep empty blocks in. - Unclosed triple quotes -
filter_commentswallows 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.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| text1 | STRING | — | |
| text2 | STRING | — | |
| text3 | STRING | — | |
| text4 | STRING | — | |
| text5 | STRING | — | |
| filter_empty_line | BOOLEAN | false | — |
| filter_comment | BOOLEAN | false | — |
| separator | STRING | \n | — |
| input | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| string | STRING | — |