Dynamic String Concat
Dynamic string concatenation without the counter pain
- text
ComfyUI's stock way to glue strings together is a fixed set of text_a, text_b, text_c inputs on a concatenate node, and if you want a fourth you rebuild the node. Dynamic String Concat does what it says on the tin: the input slots auto-expand as you connect more strings, so a prompt that starts with three parts and grows to nine never forces you to redo the wiring. It's the kind of node you don't appreciate until you've rebuilt the same concatenator three times in an afternoon.
It also covers the cases the stock node makes you wire by hand: a separator between parts, prefix/suffix, whitespace stripping, and skipping empty inputs. If you're assembling prompts from a subject node, a style library, and a quality suffix, this is the node that puts the pieces in order for you.
How it works
The slot expansion is frontend magic - the node starts with input_1 and the pack's JavaScript adds input_2, input_3, and so on as you plug connections in, trimming unused empties behind you. Server-side, each input is stripped (if you want), skipped if empty (if ignore_empty is on), and joined with the separator.
The feature worth knowing about is template mode. Leave the template widget empty and it's a plain join. Put anything in it - like "{1}, in the style of {2}" - and the node switches to interpolation: {1} gets replaced with the first input, {2} with the second, and separator is ignored entirely. Missing slots resolve to an empty string, so a partially-wired template doesn't explode. That single mode is what makes this node genuinely more useful than a plain join - you get formatting, not just concatenation.
The inputs and outputs that matter
separator- default a space; what goes between joined parts (ignored in template mode).ignore_emptyandstrip_whitespace- both default on; they're what keep your prompts from accumulating, ,artifacts.prefix/suffix- appended at the very start/end of the result. Great for a fixed negative-prompt wrapper or a common style tag.template- the mode switch described above.- Output: a single
text(STRING) that feeds into whatever CLIP encoder you're using.
Installing it
Standard MoonPack install:
cd ComfyUI/custom_nodes
git clone https://github.com/moonwhaler/comfyui-moonpack.git
or ComfyUI Manager → MoonPack → install, restart. Under MoonPack/string. No extra Python dependencies, no models.
The honest comparison
This genre is crowded, and the community's default answer for years has been kjnodes' Join String Multi - you'll see it recommended whenever someone asks "how do I concat N strings." MoonPack's version is competitive on the two things that matter: auto-expanding slots and template interpolation. It's not going to unseat kjnodes in existing workflows, but if you're already running MoonPack, it's one less pack in your custom_nodes folder. The template mode, in particular, does things Join String Multi makes you chain extra nodes for.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| separator | STRING | Separator placed between joined strings (ignored when 'template' is non-empty). | |
| ignore_empty | BOOLEAN | true | Skip inputs that are empty after stripping (join mode only). |
| strip_whitespace | BOOLEAN | true | Strip leading/trailing whitespace from each input before joining. |
| newline_between_inputs | BOOLEAN | false | Join inputs with a linefeed (\n) instead of 'separator' (join mode only). |
| newline_wrapped_separator | STRING | Advanced. If non-empty, joins inputs as LF + this text + LF, e.g. '(input) LF (text) LF (input)'. Takes precedence over 'newline_between_inputs' and 'separator' (join mode only). | |
| prefix | STRING | Prepended to the final result. | |
| suffix | STRING | Appended to the final result. | |
| template | STRING | If non-empty, slots are interpolated into {N} placeholders instead of joined. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |