Nodes/CRT-Nodes/Remove Trailing Comma (CRT)
ComfyUI Node

Remove Trailing Comma (CRT)

The one-line fix for every string that ends with a comma

By PGCRT·Created 2 years ago·Updated 2 months ago· 123
Remove Trailing Comma (CRT)
    • STRING
    input_string

    Every string-builder in ComfyUI eventually produces the same ugly artifact: "cyberpunk, neon, rainy street, " - a trailing comma from a tag joiner or a prompt concatenation that ran one step too far. Remove Trailing Comma (CRT) is the node that fixes exactly that, and only that.

    Yes, it's almost insultingly simple. But text cleanup is one of those things where a dedicated node beats doing it in your head every time, and this one sits right in the CRT/Text category next to the pack's string splitters and line removers - so if you're already building prompt pipelines in CRT-Nodes, it slots straight in.

    How it works

    One input (input_string), one output (a STRING). The node checks whether the string ends with a comma; if it does, it drops that last character. If it doesn't, it passes the string through untouched. There's no regex, no smart detection, no trimming of trailing whitespace after the comma - it removes exactly one trailing comma character and nothing else.

    If your string is "a, b, c, " (comma then space), this node strips the comma but leaves the space. That's the predictable, boring behavior you want from a utility like this - you know precisely what it'll do.

    Where it earns its keep

    • Tag list builders. Any workflow that assembles tags with a joiner ends with a dangling comma. Run the output through this before it hits the CLIP text encoder or a filename.
    • Prompt scheduling loops. When a string batcher concatenates prompt fragments, the last fragment often carries a stray comma.
    • Metadata and filenames. Save nodes that build a filename from prompt text choke less when the string is clean.

    It's the kind of node you'll forget is in your graph until you remove it and your prompts suddenly start ending with , again.

    Install and notes

    Pack-level install: ComfyUI Manager → search CRT-Nodes → install and restart, or git clone https://github.com/PGCRT/CRT-Nodes into ComfyUI/custom_nodes. You're getting the whole 106-node suite and its heavy dependency list (opencv, ultralytics, librosa, pedalboard and more) for the privilege of using this one-liner - which is fine if you're in the CRT ecosystem, and worth knowing if you're not.

    Troubleshooting is basically non-existent. The only "gotcha" worth naming: it's not a general string cleaner. If you need to strip whitespace, fix double commas, or normalize separators, this node won't help - the pack's Advanced String Replace is the one you want for that. This node does one thing, and it does it without touching the rest of your string.

    CategoryCRT/Text

    Inputs (1)

    NameTypeDefaultDescription
    input_stringSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING