DP 5 String Switch Or Connect
Five text slots, switch one or merge all
- TEXT
- CURRENT_INDEX
Same idea as the 3-input version, just with room for five strings. You either pick one of them to pass through, or concatenate all the connected ones into a single string with a joiner of your choice. Five slots is the size most people settle on: enough to break a prompt into subject / style / lighting / quality / negative-ish fragments and recombine them, without the sprawl of the ten-input node.
It's from the Desert Pixel pack, a big set of quality-of-life nodes by DesertPixelAi. Nothing in the pack generates images - these are wiring and text-plumbing tools, the same category of thing as rgthree's utilities. This node is the workhorse text switch/assembler of the bunch.
How it works
Two controls do everything. mode picks the behavior, index picks which input wins in switch mode.
mode gives you five choices:
- Switch - output just the string at
index. - Connected - glue all connected strings together directly.
- Connected with comma - join with
,, the standard prompt separator. - Connected with line break - one string per line.
- Connected with line break+ - line breaks with extra spacing.
The comma-join mode is the one you'll live in for prompt building: wire five reusable fragments and let the node assemble them. Flip to Switch when you instead want to A/B between five whole alternatives.
The inputs and outputs that matter
mode- switch, or one of the four connect styles above.index- integer 1 to 5, used only in Switch mode to selectString_01throughString_05.String_01…String_05- optional multiline inputs. They're optional, so leave any you don't need unconnected.
Outputs: TEXT (the assembled or selected string) and CURRENT_INDEX (integer). The index output is genuinely useful when you drive index from an incrementing counter to sweep through your five options - it reports which slot is live so you can label the result.
If five isn't enough, DP_10_String_Switch_Or_Connect doubles it and adds a negative-stripping mode. If it's overkill, the 3-input and 2-input versions trim down. Pick the size that matches how many fragments you actually juggle.
How to install it
- ComfyUI Manager: search "Desert Pixel", install, restart. No models or heavy deps.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/DesertPixelAi/ComfyUI-Desert-Pixel-Nodes, thenpip install -r requirements.txtif one exists, and restart.
All the pack's nodes appear under the DP menu.
Common issues
The recurring head-scratcher: setting mode to a Connected option and expecting index to filter things. It won't - connect modes use every wired string, and index is inert unless you're in Switch mode. That's by design, not a bug.
Watch empty slots too. Because the string inputs are optional, an unconnected slot just contributes nothing to a concatenation (fine), but a Switch pointed at an empty slot outputs an empty string (not fine, if you didn't mean it). If your prompt goes blank after switching, your index is almost certainly aimed at a slot you never filled.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | Switch | 5 options: Switch, Connected, Connected with comma, Connected with line break, Connected with line break+ |
| index | INT | 11–5 | — |
| String_01opt | STRING | — | |
| String_02opt | STRING | — | |
| String_03opt | STRING | — | |
| String_04opt | STRING | — | |
| String_05opt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| TEXT | STRING | — |
| CURRENT_INDEX | INT | — |