Nodes/ComfyUI_StringOps/文本组合🐠meeeyo.com
ComfyUI Node

文本组合🐠meeeyo.com

Rules with [1] [2] placeholders, up to five outputs

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
文本组合🐠meeeyo.com
    • STRING
    • STRING
    • STRING
    • STRING
    • STRING
    original_text
    concatenation_rules
    split_char

    Most "concatenate" nodes just glue strings together. TextConcatenation is the version that thinks it's a template engine: you give it a source list and a set of rules, and each rule can rearrange, repeat, and weave those source items however it likes - and it produces up to five separate outputs from one pass. If you've got a batch of items and you want them reshaped into several different prompt formats at once, this is the node.

    The Chinese display name is 文本组合 ("text combination"). It's part of ComfyUI_StringOps, and it's the smarter cousin of TextConcatenator (which is a fixed up-to-4-way joiner). Don't confuse the two - this one has the rules engine.

    How it works

    Three inputs:

    • original_text - your source. Each line (or each piece split by split_char) becomes an item, numbered 1, 2, 3... from the top.
    • concatenation_rules - one rule per line, up to 5 lines. A rule is any text with [1], [2], etc. placeholders that get filled with the matching source item.
    • split_char - what splits original_text into items. Empty means newline.

    So with original_text:

    cat
    dog
    bird
    

    and rules:

    [1] is a [2]
    [3] and [2]
    

    you get output 1 = cat is a dog and output 2 = bird and dog. Each rule line maps to one of the five STRING outputs; unused outputs come back empty.

    Where you'd use it

    Prompt construction is the sweet spot. Keep a source list of subjects, styles, and lighting in one multiline box, then write rules that assemble them into a positive prompt, a negative prompt, and a filename suffix - all in one node, all updated together. Because placeholders can repeat ([1] and [1] again) and reorder, it beats a chain of concatenators for anything non-linear. It also plays well with ShuffleTextLines upstream: shuffle your source, and the rules reshape the new order every run.

    The traps

    Placeholders are 1-based and match line numbers - if your source has fewer lines than a rule references, the unmatched [2] just stays literal in the output (there's no error, and no substitution). Empty source lines are dropped before numbering, which can shift your indices. And the 5-output limit is real: a sixth rule line is silently ignored. For real template work with conditionals, you'd want a regex/format node from a bigger pack - this is a simple engine, not a language.

    Installing it

    Pack standard: ComfyUI Manager → ComfyUI_StringOps, or

    cd ComfyUI/custom_nodes
    git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
    

    Restart. Pure Python - no extra dependencies.

    The honest take

    This is arguably the most useful node in the pack's string family, because it collapses several concatenation nodes into one multi-output formatter. It's still a mini tool - no conditionals, no padding, 5 outputs max - but for prompt reshaping it's genuinely the one you'd reach for. Give your source lines stable order, write rules once, and editing a batch becomes editing one box.

    CategoryMeeeyo/String

    Inputs (3)

    NameTypeDefaultDescription
    original_textSTRING
    concatenation_rulesSTRING
    split_charSTRING

    Outputs (5)

    NameTypeDescription
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING
    STRINGSTRING