Nodes/Arctenoxs-Essentials_ComfyUI/String Switch (Arctenox's Essentials)
ComfyUI Node

String Switch (Arctenox's Essentials)

A Two-Way String Switch for A/B Testing Prompts

By Arctenox·Created 8 months ago·Updated 2 months ago· 1
String Switch (Arctenox's Essentials)
    • selected
    • discarded
    use_string_atrue
    string_a
    string_b

    Somewhere in your workflow there's a string you keep editing back and forth - a positive prompt you're A/B testing, a LoRA list you toggle on and off, a model name you want to swap in the metadata. This node is the toggle for that: a boolean decides between two strings, so you switch with a click instead of retyping or rewiring.

    How it works

    Three inputs, two outputs. The use_string_a boolean (default on) picks which input wins: ON routes string_a out, OFF routes string_b. The second output, discarded, always carries the loser - which sounds like clutter until you realize it's perfect for logging or for keeping both variants visible while you pick one.

    Outputs:

    • selected - whichever string won the toggle.
    • discarded - whichever lost.

    That's the whole mechanism, and it's about as robust as a boolean can be. Both inputs are multiline strings, and they're plain STRING inputs, so you can wire them from other nodes (a prompt generator, a concat, a metadata field) rather than typing by hand.

    Where it earns its keep

    The killer pattern is A/B testing a prompt variant: build two different positive prompts, feed them through the switch into a CLIP Text Encode, and flip the boolean between runs while keeping the seed fixed. Same image structure, two prompts, instant comparison. The other classic is toggling a LoRA list on and off - switch between your <lora:...> string and "" and the prompt changes with one click.

    It's the string-flavored version of the node that exists in every org-oriented pack (rgthree has a whole family of these), just focused and dependency-light. If you only need two options and you already run Arctenox's Essentials, this beats installing a bigger pack for the same trick.

    The only gotcha

    A plain boolean toggle re-runs the downstream graph when flipped - which is what you want for testing. Just don't expect the discarded output to do anything clever; it's literally the other string, and if you leave it unconnected it costs nothing. Also remember: this swaps whole strings, not words. For surgically swapping one token inside a prompt, you want a replace or a wildcard node instead.

    Install

    With the pack - ComfyUI Manager (search Arctenoxs-Essentials_ComfyUI) or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Arctenox/Arctenoxs-Essentials_ComfyUI
    

    then restart. No model downloads. The usual pack caveat applies - the README marks it deprecated while the author remasters the pack - but a two-input switch is about as stable a node as exists in this ecosystem.

    CategoryArctenox Essentials/Text

    Inputs (3)

    NameTypeDefaultDescription
    use_string_aBOOLEANtrueWhen ON, outputs string_a. When OFF, outputs string_b.
    string_aSTRINGOutput when toggle is ON (String A)
    string_bSTRINGOutput when toggle is OFF (String B)

    Outputs (2)

    NameTypeDescription
    selectedSTRING
    discardedSTRING