String
The String node that cleans as it passes
- STRING
The String node is the least glamorous thing in this pack, and quietly one of the most useful. You type a value once and wire it to five different consumers, so you stop editing five copies of the same seed, style tag, or quality block by hand. ComfyUI ships its own primitives for exactly this job (PrimitiveString and friends), so the honest question is why you'd pick this one. The answer is one behavior: it cleans your text on the way out.
Mechanically it's a straight pass-through - one string input, one STRING output, nothing hidden. But every string that flows through this pack gets run through a trim helper first: leading and trailing whitespace is stripped, runs of spaces/newlines/tabs collapse into a single space, and stray commas get knocked off the ends. So "masterpiece , best quality , absurdres " comes out as "masterpiece, best quality, absurdres". Paste a sloppy tag list from a website or an old workflow and it arrives downstream tidy.
That matters more than it sounds. Sloppy spacing and trailing commas are exactly the kind of junk that makes a prompt string compare "dirty" to ComfyUI's cache, re-triggering encodes, and they bloat CLIP token counts on SD 1.5 / SDXL where every token is precious. The trim is free hygiene.
Where you'll actually reach for it: a shared style block. Type your universal quality tags once into a String node, wire it into every CLIP Text Encode in the graph, and you have one authoritative source you edit in one place - the "one seed, five samplers" pattern from the plumbing docs, applied to text.
Installing it
ComfyUI-Prompt-Helper is a small pack with zero extra dependencies - it only uses libraries ComfyUI already ships (torch, Pillow, yaml), so there's no requirements.txt to fail and no model downloads. Install via ComfyUI Manager by searching for ComfyUI-Prompt-Helper, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/elypha/ComfyUI-Prompt-Helper
Then restart ComfyUI. The node lives in the prompt_helper category.
The one gotcha
The trimming is the whole personality of this node, and it's also the trap: if you deliberately rely on line breaks or trailing commas, this node will eat them. For that you want the multi-line sibling (String (multi-line) still collapses newlines to spaces - see that page). For a single-line value you want passed through byte-for-byte, use the core PrimitiveString instead. Otherwise, this is the text box you'll happily forget exists, which is exactly the point.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |