ComfyUI Node

String Join

Join a whole list of strings on one separator

By kale4eat·Created 2 years ago·Updated 2 years ago· 7
String Join
    • string
    strings
    sep

    String Concat is for two strings. String Join is for many - it takes a whole list of strings and welds them together with one separator between every item. If you've ever had a batch of prompt pieces or a split list and wanted them as a single line, this is the node.

    What it is

    Under the hood it's Python's sep.join(strings): every string in the list gets connected by the same separator, with no separator at the start or end. So joining ["best", "quality", "masterpiece"] with ", " gives "best, quality, masterpiece". With " " you get a sentence; with "\n" you get a block of lines.

    Two implementation details matter for how you use it. The strings input is list-typed (INPUT_IS_LIST), and the schema marks it forceInput - meaning you can't type a value into it, you have to wire a list in from another node. And the separator is also received as a list internally; the node uses sep[0], so connect exactly one separator string and it works as expected.

    The inputs and outputs

    • strings (STRING, list) - the items to join. Must be wired from a list-producing output, like the String Split node in this same pack.
    • sep (STRING) - the glue, e.g. ", ", " ", "\n", or "" if you want no gap at all.
    • string (STRING) - the joined result.

    It's the natural partner to String Split: split a CSV-style line into a list, rearrange or filter the items, then Join them back into a clean prompt with the separator you actually want.

    How to install it

    Same tiny dependency-free repo as the rest of the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kale4eat/ComfyUI-string-util
    

    or via ComfyUI Manager (search "ComfyUI-string-util"), then restart. It's under the string-util category.

    Common issues

    The main trap is the list input: if you try to double-click and type text into strings, nothing happens - that input is strictly wire-in. If you wire a non-list string in, ComfyUI may complain or behave oddly depending on the source node, so feed it from a genuine list output. Also remember the separator appears between every pair - there's no "only if the item isn't empty" filtering. If your list has empty strings in it, you'll get doubled separators, and that's a You problem, not a node problem.

    Categorystring-util

    Inputs (2)

    NameTypeDefaultDescription
    stringsSTRING
    sepSTRING

    Outputs (1)

    NameTypeDescription
    stringSTRING