String Format
The small node that builds your prompts out of parts
- arg_0
- STRING
At some point every ComfyUI workflow needs to assemble a string from pieces - a prompt built from a subject plus a style plus a seed, a filename with a date, a JSON payload for an API node. String Format from Duanyll Nodepack is the tool for that, and it's exactly as boring and useful as it sounds: you give it a template with {} placeholders and it fills them in, in order, from the argument inputs you connect.
This is Python's str.format() exposed as a node. If you've ever written "a photo of a {} in {} style".format(subject, style) in a scripting workflow, this is that - without the scripting. It's a utility node, and honestly one of many. What makes it worth remembering is that it lives in the same pack as the rest of duanyll's data plumbing, so when you're building an LLM-driven graph with ParseLlmJsonOutput on one side and an API call on the other, you don't need a second pack just to join strings.
How it works
The template is a plain Python format string. Placeholders are positional: the first {} is filled by arg_0, the second by arg_1, and so on. The node has one optional input, arg_0 (any type), plus a bit of frontend magic - the pack ships a small JS extension that registers String Format for dynamic inputs, so new arg_N sockets appear as you connect values to the previous one. Connect two things and you get arg_1; keep going and it grows with you.
Inputs and outputs
template(STRING, multiline) - your format string,{}and all.arg_0(any type) - the first value; dynamic siblings appear as you wire more in. Numeric values get stringified automatically, so seeds, step counts and aspect ratios drop straight in.STRING- the finished text. Wire it into a CLIP text encode, a prompt, a filename prefix, or one of the pack's API nodes.
Because every argument is "any" typed, you can throw numbers and booleans at it without conversions. That's the convenience; it's also the only real danger.
Common issues
- More placeholders than args.
"{} and {}"with onlyarg_0wired throws an error, becauseformat()gets one argument for two slots. Count your braces against your inputs. - Literal braces. Want a literal
{or}in the output? Python format syntax needs them doubled -{{and}}. One lone brace is a format error, not a character. - Named fields won't work. It's positional-only under the hood;
{name}won't resolve. If you need named substitution, you're looking at the wrong node.
Install
Same as the rest of the pack - ComfyUI Manager, search Duanyll Nodepack, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
No model downloads, no extra config. If you're already running any node from this pack, String Format is already on your machine - just add it to the graph.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| template | STRING | — | |
| arg_0opt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |