π― YFG Text Concat Swap
Stop rewiring StringConcatenate every time β flip your prompt order with one click.
- text
- order
If you build prompts out of parts - subject, style, quality tags - you know the dance: you want to test "subject, style" against "style, subject", so you reach for the core StringConcatenate node, and then you're rewiring its inputs or editing text every time you flip the order. Word order matters in SD prompts (the front of the prompt carries the most weight), so this is a genuinely useful thing to iterate on.
YFG Text Concat Swap is a tiny node from the YFG Comical pack that does the obvious thing: joins two strings with a delimiter, and gives you a single clickable toggle that swaps which string comes first. The toggle isn't a mystery checkbox - it's a labeled button that literally reads A + B or B + A on the node face, so the current order is visible at a glance. One click, order flipped, run again.
How it works
Mechanically it's as simple as it looks: text_a + delimiter + text_b with swap off, text_b + delimiter + text_a with swap on. But the small quality-of-life details are what make it feel better than doing the same thing with core nodes:
- No dangling delimiters. If one side is empty, it's dropped before joining - a muted or unconnected branch never leaves a stray
,in your prompt. None-safe. ANonearriving from a muted upstream node (say, a bypassed VL captioner) is coerced to an empty string instead of crashing the graph.- Escape-aware delimiter. The delimiter widget is single-line, but you can type
\n,\tor\sin it to get a newline, tab, or plain space. trim_parts(default on) strips whitespace from each side before joining, so sloppy text boxes don't produce double spaces.
Both text widgets honor ComfyUI dynamic prompts, and either can be converted to an input socket and driven from an upstream node.
The inputs and outputs
Five inputs, and you'll barely touch most of them:
text_a/text_b- the two strings. Multiline.delimiter- the joiner, default,.swap- the whole point.A + B(off) orB + A(on).trim_parts-trim(default) orraw.
Outputs are text (the joined result) and order - a string that says A + B or B + A, reflecting the current toggle. That second output is a nice touch: wire it into a display node or into saved metadata (like YFG's own CivitAI MetaSave, which lives in the same pack) so your filenames can record which order you used.
Installing it
It ships in the YFG Comical pack, so:
cd ComfyUI/custom_nodes
git clone https://github.com/gonzalu/ComfyUI_YFG_Comical
then restart ComfyUI - or search "YFG Comical Nodes" in ComfyUI Manager. There's genuinely nothing else to set up: the node is pure Python stdlib, no extra dependencies, no model files, no API keys.
Should you bother?
It's a small utility, so temper expectations: if you hand-type your prompts in one box, this isn't for you. If you assemble prompts from components - subject clip, style clip, a quality-tags string from a random-prompt node - it's the kind of node that saves you a minor annoyance several times per workflow-building session. It won't change your outputs, but it makes the A/B of prompt ordering a one-click test instead of a rewiring chore. That's a fair trade for a zero-dependency node.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text_a | STRING | First string when swap is OFF. | |
| text_b | STRING | First string when swap is ON. | |
| delimiter | STRING | , | Joiner. Supports \n, \t and \s escapes. |
| swap | BOOLEAN | false | Click to flip the concatenation order. |
| trim_parts | BOOLEAN | true | Strip leading/trailing whitespace from each part. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text | STRING | β |
| order | STRING | β |