Nodes/ComfyUI_StringOps/常规处理字符🐠meeeyo.com
ComfyUI Node

常规处理字符🐠meeeyo.com

One node to clean every prompt before it hits the text encoder

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
常规处理字符🐠meeeyo.com
    • STRING
    input_string
    option不改变

    The prompt box is the one input you touch on every generation, and it's also where junk quietly accumulates: stray newlines from a copied list, mixed case from a machine-translated tag set, punctuation soup, phantom spaces. ProcessString is a one-node cleanup station for exactly that - paste text in, pick one of twelve operations from a dropdown, and get a clean string out the other side. It ships in the MeeeyoAI/ComfyUI_StringOps pack, and like every node in that pack the menu labels are in Chinese, so you'll be choosing among options like 取数字 (extract digits) rather than reading English menus.

    Why bother cleaning at all? CLIP text encoders are literal. A newline in the middle of a prompt, a stray comma, an extra space - none of them alone is catastrophic, but they all change tokenization. When you're comparing two batches to figure out why the output drifted, "one prompt had a trailing newline" is the worst kind of bug: invisible, reproducible, and nobody wants to admit it. Running both prompts through the same normalization step before encoding makes the comparison honest.

    The inputs that matter

    Only two, which is the whole appeal:

    • input_string - a multiline box you can paste a whole prompt block into.
    • option - the dropdown with twelve choices:
      • 不改变 (no change), 取数字 (keep only digits), 取字母 (keep ASCII letters only), 转大写 (uppercase), 转小写 (lowercase), 取中文 (keep only Chinese/CJK characters), 去标点 (strip punctuation), 去换行 (remove line breaks), 去空行 (remove blank lines), 去空格 (remove spaces), 去格式 (strip all whitespace), 统计字数 (count characters).

    The output is a single STRING, ready to feed a CLIP Text Encode node or another string node in this pack.

    The mechanisms that trip people up

    A few of these options are subtler than they look, and knowing the difference saves you a confused half hour:

    • 取空格 only removes the ASCII space character. Tabs and newlines survive. That's why 去格式 exists - it strips all whitespace with one regex, which is usually what people actually want when they think "clean this up."
    • 取字母 deliberately drops Chinese characters (the node's logic keeps anything isalpha that isn't in the CJK range), so on mixed-language text it behaves the opposite of what you might guess.
    • 统计字数 returns the count as a string, not a number. It feeds other text nodes, not math nodes. Count on that before wiring it into a comparison.

    It's a pure text transform - no randomness, no state. It also defines IS_CHANGED() to always fire, so it re-runs every queue execution, which costs nothing and means the output is always fresh.

    Installing it

    This is a no-drama install. Via ComfyUI Manager, search for ComfyUI_StringOps (or the author's handle, meeeyo) and click install, or clone it directly:

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

    Restart ComfyUI. The pack's requirements.txt (requests, numpy, torch, Pillow, openpyxl, chardet, pytz and friends) is light - no model downloads, nothing you won't already have in a working ComfyUI. If the node doesn't show up after a restart, use Manager to update the pack, then restart again; that's the fix in the vast majority of cases.

    Realistically, ProcessString is one of the more useful entries in a pack that's mostly niche. It's not flashy - it's the node you reach for when a workflow keeps misbehaving and the cause turns out to be text hygiene. That's a surprisingly large share of "why is my prompt not working" questions.

    CategoryMeeeyo/String

    Inputs (2)

    NameTypeDefaultDescription
    input_stringSTRING
    optionCOMBO不改变12 options: 不改变, 取数字, 取字母, 转大写, 转小写, 取中文, +6

    Outputs (1)

    NameTypeDescription
    STRINGSTRING