Nodes/XB_ToolBox/XB-BOX - 📝 字符串合并
ComfyUI Node

XB-BOX - 📝 字符串合并

Join N strings without a tangle of text nodes

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 📝 字符串合并
    • string
    inputcount2
    string_1
    delimiter
    return_listfalse
    newline_per_segmentfalse
    string_2

    String handling is the plumbing nobody writes articles about, which is exactly why a pack aimed at beginners ships a good merge node. XB_StringMerge takes several text inputs and joins them into one, with a delimiter you control. That's the whole job. It's a rework of KJNodes' JoinStringMulti, and it's the kind of node that quietly makes dynamic prompts, multi-segment video captions, and batched text generation far less annoying to wire.

    The honest pitch: this is where ComfyUI's graph model shines and stumbles at the same time. You can merge strings with a chain of nested + operations or concatenation nodes, but it turns a simple join into spaghetti. One node with N sockets and a separator field beats that.

    The inputs that matter

    • inputcount - how many string sockets you want, from 2 to 1000. Change the number and hit Update inputs to add slots. This is the node's superpower: you decide the fan-in after you drop it on the canvas.
    • string_1 (and string_2 onward) - the text to join. Left unwired, empty strings are simply skipped rather than producing "a + " garbage.
    • delimiter - the separator, default a space. Set ",", "; ", " " - whatever your downstream prompt format wants.
    • return_list - default off. On, it emits a Python list of the strings instead of one merged string. Use it when you're feeding a batch-style consumer that wants separate strings per item.
    • newline_per_segment - the pack's own addition over KJNodes. On, it ignores the delimiter and joins every segment with a newline. Perfect for building multi-line prompts where each line is its own concept or scene.

    Output

    One string output, typed STRING (it can be a list when return_list is on - the engine is told via OUTPUT_IS_LIST). Wire it into a prompt encoder, a text-concat consumer, or anything in the pack's llama/text family that wants assembled text.

    Two honest gotchas

    The first is the "Update inputs" ritual: the sockets don't auto-grow when you type a bigger number, so remember the button or you'll wonder why slot 3 is missing. The second is a quirk inherited from its design - the description field tells you to look for the update button in the node's own tooltip, which is a small UX hiccup in a pack that otherwise cares a lot about UX. Neither is a reason to avoid it; they're just the two things that'll trip you on day one.

    Install: Manager → XB_ToolBox, or git clone https://github.com/wjluoxiao/XB_ToolBox.git into custom_nodes, restart. It's under "XB_ToolBox/Text". Pure Python, no dependencies.

    CategoryXB_ToolBox/Text

    Inputs (6)

    NameTypeDefaultDescription
    inputcountINT22–1000
    string_1STRING
    delimiterSTRING
    return_listBOOLEANfalse
    newline_per_segmentBOOLEANfalse每段换行:打开后,每段输入字符串将换行排列
    string_2optSTRING

    Outputs (1)

    NameTypeDescription
    stringSTRING