ComfyUI Node

DP 2 String Switch

The dead-simple A/B toggle for two prompts

By DesertPixelAi·Created 2 years ago·Updated about a year ago· 25
DP 2 String Switch
    • TEXT
    String_01
    String_02
    SourceString_01

    You've got two prompts and you keep swapping between them to compare. Maybe a "clean" version and a "busy" version, or your day look and your night look. Instead of cutting and pasting text back and forth into a single box, this node holds both at once and lets you flip which one flows downstream with a dropdown. That's the whole job, and it does it without fuss.

    It lives in the Desert Pixel pack, a big grab-bag of quality-of-life nodes by DesertPixelAi. It's not a famous pack - you won't see it recommended in every "must-have nodes" thread the way rgthree or Impact Pack are - but it's cut from the same cloth: none of these nodes generate anything, they just make a workflow less annoying to live in. This one is about as small as a node gets.

    How it works

    It's a toggle with two text fields built in. You type (or wire) two strings, then pick which one leaves the node. No index math, no concatenation, no modes to learn. Flip the dropdown, requeue, done.

    Where you'd actually reach for it: keeping two candidate prompts side by side during a tuning session, or parking a "safe" prompt next to an experimental one so you can bounce between them on a fixed seed. It's the kind of node you drop in for twenty minutes of A/B work and it earns its place.

    The inputs and outputs that matter

    Everything here is required, and there are only three things:

    • String_01 and String_02 - the two multiline text fields. These are real text boxes on the node, so you can paste prompts straight in, or wire strings into them from elsewhere.
    • Source - the switch itself, a dropdown with exactly two choices, String_01 or String_02. Whichever you pick is what comes out.

    The single output is TEXT (a string). Wire it into your CLIP Text Encode, a prompt cleaner, or any node that eats text.

    If you need more than two options, that's what the bigger siblings are for - DP_3_String_Switch_Or_Connect, DP_5_..., and DP_10_... go up to ten inputs and add concatenation modes on top of the plain switch. This node deliberately doesn't. Two in, one out, one dropdown.

    How to install it

    Two ways, both painless since there's nothing to download:

    • ComfyUI Manager: open the Manager, search for "Desert Pixel", hit install, restart ComfyUI.
    • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/DesertPixelAi/ComfyUI-Desert-Pixel-Nodes, and if a requirements.txt came along, pip install -r requirements.txt. Restart.

    Everything from the pack shows up under the DP category in the node menu (right-click → Add Node → DP), so search "DP 2 String Switch" or browse there.

    Common issues

    There's very little to go wrong with a node this size. The one thing that trips people: it switches, it doesn't merge. If you were expecting both strings to come out joined together, you want one of the "Or Connect" nodes instead - this one only ever passes a single field through.

    The other thing is remembering that Source is set by the dropdown, not by which field has text in it. If the output looks stale, check that the dropdown is actually pointing at the field you edited. And since it's just moving text around, if your generation didn't change after flipping the switch, confirm the output is really wired into your encoder and not into a dead end - the switch will happily route text to nothing.

    CategoryDP/text

    Inputs (3)

    NameTypeDefaultDescription
    String_01STRING
    String_02STRING
    SourceCOMBOString_012 options: String_01, String_02

    Outputs (1)

    NameTypeDescription
    TEXTSTRING