Nodes/ComfyUI_StringOps/添加前后缀🐠meeeyo.com
ComfyUI Node

添加前后缀🐠meeeyo.com

Wrap any string in a prefix and suffix — the two-field wrapper

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
添加前后缀🐠meeeyo.com
    • STRING
    input_string
    prefix前缀符
    suffix后缀符

    AddPrefixSuffix is the plainest node in MeeeyoAI/ComfyUI_StringOps: take an input string, slap a prefix on the front, a suffix on the back, return the result as one STRING. Three text inputs, one text output, zero cleverness. Which, honestly, is exactly why you'll end up using it.

    Prompt quality phrases are almost always a sandwich. "masterpiece, best quality, " in front of the subject, ", highly detailed, 8k" behind it. With this node you write the bread once and swap the filling, instead of re-typing the wrapper into every prompt field in the graph. It's also the natural tool for generating filenames from a base name, or wrapping a dynamically-generated string with fixed framing that a downstream process expects.

    The inputs

    • input_string - the text to wrap (default empty).
    • prefix - prepended verbatim (default 前缀符, the Chinese placeholder for "prefix char" - replace it).
    • suffix - appended verbatim (default 后缀符, "suffix char").

    No joining logic, no trimming, no spaces added for you. If you want "cat" to become "masterpiece, a cat, best quality", the prefix is masterpiece, and the suffix is , best quality - punctuation and spaces are on you, and the node will not save you from a missing comma.

    The gotchas

    The concatenation is naive in a way that's usually fine and occasionally annoying:

    • Empty prefix or suffix is allowed - so it doubles as a one-sided prepend or append. Handy, if undocumented.
    • There's no conditional behavior: the prefix goes on every time, period. If you want "only wrap when this other text is present," you want ConditionalTextOutput from the same pack, not this node.
    • It operates on the whole input as one unit. If your input has multiple lines, the prefix lands before line one and the suffix after the last line - not on every line. For per-line wrapping, AddPrefixSuffixToLines (same pack) is the sibling that does that.

    If you're building prompts from parts, this node tends to pair with the pack's concatenation and random-line nodes: generate a random subject line, wrap it with quality tags, feed the result to a CLIP Text Encode. It's also handy for stamping filenames - prefix the scene ID, suffix the extension.

    Installing

    The standard pack install:

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

    or Manager, searching ComfyUI_StringOps, then restart. Under "Meeeyo/String". No models, no dependencies to worry about.

    It's the kind of node you forget is in the pack until you find yourself typing "masterpiece, best quality, " into the eighth prompt field of the day. Then it stops being trivial and starts being a small kindness.

    CategoryMeeeyo/String

    Inputs (3)

    NameTypeDefaultDescription
    input_stringSTRING
    prefixSTRING前缀符
    suffixSTRING后缀符

    Outputs (1)

    NameTypeDescription
    STRINGSTRING