Nodes/ComfyUI-StringsAndThings/Formatting Single String
ComfyUI Node

Formatting Single String

Wrap one string with fixed text before and after

By PressWagon·Created 2 years ago·Updated about a year ago· 3
Formatting Single String
    • FormattedString
    PRE_string
    BODY_string
    POST_string

    Formatting Single String is the smallest, least exciting node in the pack, and it's exactly as useful as that suggests. You give it a BODY_string and optional PRE_string / POST_string; it hands back pre + body + post as one FormattedString. That's the entire feature list. If you already have the big three-slot FormatConcatStrings, this is its one-slot sibling for when you only need to wrap a single value.

    The pattern is everywhere once you start automating text: a LoRA filename that needs to become <lora:NAME:0.8> for a prompt, or "LoRA: NAME" for a metadata line. You could type that framing into every formatter manually, but when the NAME is dynamic - coming from a Lora Selector or a wildcard node - you want the framing fixed and the middle flowing through. That's this node.

    How it works

    One rule makes it safe to use in graphs with optional inputs: if BODY_string is empty, the output is an empty string - pre and post text are not included. So you can hang it off a value that might not exist, and instead of a stray "<lora::0.8>" or "LoRA: " you get nothing at all, which then disappears cleanly from whatever joins it.

    Beyond that it's a straight concatenation. The three inputs are all optional, all single-line:

    • PRE_string - fixed text before the body (e.g. <lora: or "Styles: ").
    • BODY_string - the dynamic middle.
    • POST_string - fixed text after (e.g. :0.8> or a comma).

    Output is FormattedString, and it's an output node - the branch runs even if nothing downstream reads it.

    Where you'll reach for it

    Pair it with Lora Selector's metadata output to build one LoRA line for your image saver. Chain a couple for multi-part metadata. Use it before a wildcard processor if your wildcard syntax needs wrapping. It's also the cleanest way to test "does this node output what I think" - a quick pre of DEBUG: turns any value into something you can spot at a glance.

    You won't reach for it when you need three independent optional slots - that's FormatConcatStrings, which also joins with a separator. FormattingSingle has no separator; it's purely pre+body+post on one string.

    Installing it

    It ships with the rest of ComfyUI-StringsAndThings, so you can't grab it alone. ComfyUI Manager: search "ComfyUI-StringsAndThings" → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/PressWagon/ComfyUI-StringsAndThings
    

    No models, no config. The pack's requirements pin scipy and exact torch/numpy versions, but those are already present in any working ComfyUI install, so installation is genuinely painless.

    Caveats

    • Single-line inputs only (multiline: false) - don't expect a text area for long blocks.
    • The empty-body rule keys on falsy strings: a BODY_string containing a space or a 0 is treated as real content. If a node insists on existing when you wanted it gone, that's why.
    • Not batch-aware, like every node in this pack. One string in, one out.
    CategoryStrings&Things

    Inputs (3)

    NameTypeDefaultDescription
    PRE_stringoptSTRING
    BODY_stringoptSTRING
    POST_stringoptSTRING

    Outputs (1)

    NameTypeDescription
    FormattedStringSTRING