Nodes/SDXL Auto Prompter/APNext String Merger
ComfyUI Node

APNext String Merger

Glue two strings together, comma or 'and'

By dagthomas·Created 3 years ago·Updated 12 days ago· 283
APNext String Merger
    • STRING
    string1
    string2
    use_andfalse

    The most boring node in the pack, and one you'll actually use. It takes two strings and joins them into one. That's it. But "join two prompt pieces" is a thing you need constantly once your workflow has more than one text source - a subject from here, a style from there - and having a dedicated little merger beats a tangle of concatenation hacks.

    Every prompt pack accumulates a couple of these plumbing nodes because ComfyUI's graph makes you think about where text comes from and where it goes. String Merger is that plumbing.

    How it works

    You give it string1 and string2, and it concatenates them. The use_and toggle decides the joiner: off, it merges them with a comma-style separator (the default tag-friendly join); on, it links them with "and", which reads more like natural language. So use_and off gives you sunset, mountains and on gives you something closer to sunset and mountains. Pick based on whether you're building a tag prompt or a sentence prompt. No model, no API, no randomness - deterministic string glue.

    Inputs and outputs that matter

    • string1 / string2 - the two pieces to join. Either can come from another node's output or be typed inline.
    • use_and (boolean) - comma-style join (off) versus "and" join (on). This is the only real decision, and it's about matching your model: comma for tag-based SDXL/Illustrious, "and" reads better in a sentence prompt for LLM-encoded models.

    The single output is STRING - wire it into a CLIP Text Encode or chain it into another merger to combine more than two sources.

    Installing it

    ComfyUI Manager: search comfyui_dagthomas, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/dagthomas/comfyui_dagthomas
    cd comfyui_dagthomas
    pip install -r requirements.txt
    

    Pure string handling - no API key, no downloads. The pack's heavier requirements serve its LLM and image-FX nodes, not this one.

    Common issues

    There's almost nothing to break here, which is the point. The one thing to watch is spacing and separators: if you're merging two already-comma-separated tag lists with use_and off, check you don't end up with a doubled or missing separator at the seam - glance at the joined output before it hits your encoder. And if you need to combine more than two strings, just chain a second String Merger; it's cheaper than reaching for a heavier utility node. For anything involving shuffling rather than plain joining, use this pack's Sentence Mixer instead - different job.

    Categorycomfyui_dagthomas

    Inputs (3)

    NameTypeDefaultDescription
    string1STRING
    string2STRING
    use_andBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    STRINGSTRING