ComfyUI Node

Text Case Converter

Snake_case, camelCase, kebab-case — for filenames and code

By DebugPadawan·Created about a year ago·Updated 5 months ago· 2
Text Case Converter
    • converted_text
    texthello world
    mode

    The other case node in this pack is for humans. Text Case Converter is for computers. It takes any text and converts it into the naming conventions machines and file systems actually use - snake_case, kebab-case, camelCase, PascalCase - alongside the usual UPPER/lower/Title/Sentence styles. If you're generating filenames, variable names, or tags that another system will parse, this is the node that makes the casing consistent.

    It's part of DebugPadawan's ComfyUI Essentials, a pure-Python utility pack. The mechanism: it strips non-alphanumeric characters into word boundaries, then rejoins them per the selected style.

    How it works

    Two required inputs:

    • text - the string to convert (multiline-friendly, default "hello world")
    • mode - the dropdown with eight choices: UPPER, lower, Title Case, Sentence case, snake_case, kebab-case, camelCase, PascalCase

    One output: converted_text - the result.

    For the four "code" modes, the node tokenizes by replacing every non-alphanumeric character with a space and splitting, then rejoins:

    • snake_casehello_world
    • kebab-casehello-world
    • camelCasehelloWorld (first word lower, the rest capitalized)
    • PascalCaseHelloWorld (all words capitalized, no separator)

    The bonus is that it's smart about input: "Hello World", "hello-world", and "hello_world" all tokenize to the same words, so converting between conventions is genuinely round-trippable. Sentence case capitalizes each sentence after a . - a nice touch over plain lower.

    Where you'll use it

    • Filenames. kebab-case or snake_case for save nodes so files stay parser-friendly.
    • Tags and metadata. Normalize tag strings into a consistent convention for downstream systems that expect one.
    • Prompt building. Title Case for display text, UPPER for emphasis keywords.
    • Round-tripping. Bring in data from one convention, convert to another for export.

    Installing it

    Whole pack, one install. ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
    

    Then restart ComfyUI. Requirements (numpy, torch, opencv-python) are already in stock ComfyUI; no models to fetch. When searching Manager, don't confuse this pack with cubiq's "ComfyUI Essentials" - a different, larger pack in maintenance mode.

    Gotchas

    • The tokenizer drops non-alphanumeric characters entirely. "50/50" becomes the single word "5050"camelCase gives "5050", not "50-50". If your text has meaningful punctuation or digits with separators, this can mangle it - keep digits and symbols out of what you feed it.
    • Unicode/accented characters get stripped by the [^a-zA-Z0-9] tokenizer, so "café" becomes "caf". Pure ASCII in, clean ASCII out; that's the trade-off.
    • Empty input returns empty string rather than erroring - graceful, just be aware.
    • Small, quiet pack; the behavior is deterministic enough that the source is the doc.
    CategoryDebugPadawan/Text

    Inputs (2)

    NameTypeDefaultDescription
    textSTRINGhello world
    modeCOMBO8 options: UPPER, lower, Title Case, Sentence case, snake_case, kebab-case, +2

    Outputs (1)

    NameTypeDescription
    converted_textSTRING