Nodes/Comfyui_PDuse/PD:stringconcate
ComfyUI Node

PD:stringconcate

The two-string joiner with a delimiter you control

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PD:stringconcate
    • joined_string
    string1
    string2
    delimiter,

    Join two strings with a separator. That's the node - PD:stringconcate takes string1, string2, a delimiter, and outputs string1 + delimiter + string2. If you've ever built a filename from a prefix and an index, or a prompt from a style tag and a subject, you've hand-rolled this. It's the smallest useful thing a text pipeline needs, and it sits in the PDuse pack as the building block the bigger string nodes are assembled from.

    The whole point of having it as a node rather than typing the string is that both inputs are forced sockets - so the pieces can come from other nodes. That's the "value nodes fight repetition" idea from the plumbing layer: define the pieces once, join them in many places, never retype.

    How it works

    The implementation is one line: string1 + delimiter + string2. No trimming, no smart handling of empty strings, no surprises - the delimiter is always inserted, even if one side is empty. So with the default delimiter = "," and an empty string2, you get "hello," not "hello". That's the main behavioral quirk to remember, and it's the reason people reach for the delimiter field: set it to _ when building filenames, , when building prompt lists, \n when stacking lines.

    The inputs that matter

    • string1 / string2 (STRING) - both forced as input sockets; wire them from PD:String or any string source.
    • delimiter (STRING, default ,) - the separator. This is the one you'll actually change.

    Output: joined_string.

    Installing it

    Part of Comfyui_PDuse by 7BEII. ComfyUI Manager (search "PDuse") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/7BEII/Comfyui_PDuse.git
    cd Comfyui_PDuse
    pip install -r requirements.txt
    

    Restart. No models; the pack's deps (numpy, Pillow, scipy, opencv-python, torchvision) cover it. Docs are Chinese-first.

    Where people get burned

    The unconditional delimiter is the trap - with default settings, an empty input still contributes its separator, so you can end up with a leading or trailing comma you didn't intend. If your strings are sometimes empty, check what's on the wire first (a PD Show Text tap is the quick way). And note it's strictly two strings: three inputs means chaining two of these, or using the pack's multi-line join variant if you want newline joining between N items.

    CategoryPDuse/Text

    Inputs (3)

    NameTypeDefaultDescription
    string1STRING
    string2STRING
    delimiterSTRING,

    Outputs (1)

    NameTypeDescription
    joined_stringSTRING