Nodes/ComfyUI Easy Use/easy stringJoinLines
ComfyUI Node Runs on cloud

easy stringJoinLines

Collapse a multiline block into one delimited line

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
easy stringJoinLines
    • STRING
    string
    delimiter |

    You've got a text box with one item per line, and you need it as a single line with the pieces separated by commas (or pipes, or whatever). easy stringJoinLines does exactly that - it takes multiline text and joins every line into one string, glued together with a delimiter you choose. Small node, but it turns up constantly the moment you start doing anything with prompt lists or wildcards.

    The classic case: you keep a tidy list of prompt fragments, one per line, and you want them merged into a single comma-separated prompt to feed a CLIP encode. Or you built up lines through a loop and now need them as one flat string to save or display.

    How it works

    It reads the input string, splits it on line breaks, and rejoins the parts with the delimiter between them. Newlines out, delimiter in. That's the whole operation.

    The inputs and outputs that matter

    • string (multiline) - your text, one item per line.
    • delimiter (default " | ") - what goes between the joined pieces. Change it to ", " for a comma-separated prompt, " " to just flatten to spaces, or anything else you need.
    • STRING (output) - the single joined line.

    How to install it

    ComfyUI Manager: search ComfyUI-Easy-Use, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yolain/ComfyUI-Easy-Use
    

    then install.bat / pip install -r requirements.txt, restart. No models.

    Common issues & troubleshooting

    Extra delimiters from blank lines. If your multiline input has empty lines, some of them may get joined too, leaving you with foo | | bar and a stray separator. Trim blank lines before joining, or clean the result downstream.

    Default delimiter isn't what you want for prompts. The default is " | ", which is fine for display but not what a text encoder wants. For an actual prompt, set the delimiter to ", " so the encoder reads it as a normal comma-separated list.

    It joins; it doesn't split. This is the one-way flatten. If you need to go the other direction - one line into many, or text into numbers - that's a different node (easy stringToIntList for the number case).

    Whitespace surprises. The delimiter is inserted literally, so leading/trailing spaces in it are kept. If you get odd spacing, check whether your delimiter (or your source lines) already carry spaces you didn't mean to include.

    Pairs with the pack's prompt-line nodes. Easy-Use has a small family of text tools - line selectors, prompt-line builders, wildcards - that emit or consume one-item-per-line text. stringJoinLines is the "flatten it back to a single prompt" end of that pipeline: build or filter your lines upstream, join them here, encode the result. If your prompt is coming out as several separate lines when the encoder wanted one string, this is the node that was missing.

    Keep it dumb on purpose. It's a string join and nothing more - no dedup, no sorting, no trimming. That's fine; do any cleanup (removing blanks, lowercasing, sorting) with a dedicated text node before this one, and let stringJoinLines just do the last step.

    CategoryEasyUse/Logic

    Inputs (2)

    NameTypeDefaultDescription
    stringSTRING
    delimiterSTRING |

    Outputs (1)

    NameTypeDescription
    STRINGSTRING