String (Inline 5)
One prompt template, five things you can swap
- STRING
Five strings walk into a prompt. This is the node that gets them there without turning your graph into a text-farm.
What it is
String (Inline 5) is a multiline text box where up to five slots get filled in from elsewhere. You write the body of the prompt - the part that never changes - and drop {{text_a}} through {{text_e}} tokens wherever something varies. Each token can be wired to a text output from anywhere in the graph. Whatever doesn't change stays typed once, in one place.
That's the whole value proposition: the shared prompt lives in one node, and the per-image parts arrive over wires. In a pack built around multi-reference editing with Krea 2 and Ideogram 4, that's the difference between a graph you can actually read and one where you're maintaining four near-identical prompt boxes and hoping you updated all of them. The sibling node String (Inline) does the same thing with two slots; this is the one with five.
You'd reach for it when you're assembling a prompt from pieces: an identity description from one branch, an outfit or setting from another, a caption pulled off disk by Load Image Full, a fixed style suffix you paste in once. Or when you want to A/B swap a single clause without retyping anything.
How it works
Literal string replacement, nothing cleverer. For each token, in order from text_a to text_e, the node runs str.replace on the text:
if text_a is not None:
out = out.replace("{{text_a}}", text_a)
Two consequences fall out of that. Replacements happen in a fixed order, so if a value you pass into text_a itself contains {{text_b}}, it will get expanded by the subsequent pass. And a token is only substituted if its input is connected - an unconnected socket leaves the braces sitting in your prompt.
Inputs and outputs
text- the required multiline box, default{{text_a}}. This is where the template goes.text_a…text_e- five optional STRING inputs, each with the author's own tooltip: "Replaces every {{text_a}} token in the text." All five areforceInput, so they only exist as sockets. You can't type into them.STRING- one output. Wire it to a CLIP or Qwen-VL text encode, or into the pack'sConcatenateif you're stacking templates.
Installing it
It comes with the Rebalance Pack.
cd ComfyUI/custom_nodes
git clone https://github.com/nova452/Rebalance-Pack.git
# restart ComfyUI
Manager: search Rebalance Pack (publisher nova452). The GitHub repo is currently Rebalance-Pack but was renamed from ComfyUI-ConditioningKrea2Rebalance - both URLs resolve, so an older link isn't wrong, just old. No dependencies to install and no models to fetch; it's pure Python string handling.
Where it bites
Unconnected tokens leak through verbatim. Leave {{text_d}} in the template without wiring text_d, and the encoder receives the braces. Models are forgiving about junk in a prompt, which is exactly why this is nasty - you get a slightly worse image and no error. If you want a slot to vanish, connect a primitive set to "" rather than leaving it empty of wires.
Matching is exact. {{text_a}} matches; {{ text_a }} and {{Text_A}} don't. Spaces are part of the token. And there's no escaping, so you can't emit a literal {{text_a}} into a prompt on purpose - annoying only if you're templating for something that uses the same brace syntax.
The inputs are sockets, not fields. Beginners click where the value should go and nothing happens. If you just want to type text into this node, type it in the text box; text_a and friends are for wires. For the human-typed case, the pack's Input node or core's PrimitiveStringMultiline is what you want.
And check the result, not the intent. This node doesn't tell you what it produced. If a substitution looks wrong downstream, the fastest debug is a preview of the string - anything that displays a STRING - rather than reading the template in the node and assuming it took.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | {{text_a}} | — |
| text_aopt | STRING | Replaces every {{text_a}} token in the text. | |
| text_bopt | STRING | Replaces every {{text_b}} token in the text. | |
| text_copt | STRING | Replaces every {{text_c}} token in the text. | |
| text_dopt | STRING | Replaces every {{text_d}} token in the text. | |
| text_eopt | STRING | Replaces every {{text_e}} token in the text. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |