ComfyUI Node

capitalize

First letter up, everything else down — Python's capitalize, exactly

By StableLlama·Created about a year ago·Updated 4 days ago· 48
capitalize
    • STRING
    string

    capitalize takes a string and converts the first character to uppercase and everything else to lowercase. It's Python's str.capitalize() exposed as a node - one input, one output, and no options to fiddle with.

    Where it earns its keep is cleaning up text that arrives from inconsistent places - filenames, labels, prompt fragments, tag lists where someone hit caps lock. "hELLO wORLD" becomes "Hello world", which is exactly the normalization you want before comparing or displaying strings. This pack has a whole STRING category of these case transforms (title, upper, lower, casefold), and capitalize is the one for "sentence-style, first word only."

    How it works

    The mechanism is literally string.capitalize(): uppercase the first character, lowercase the rest. Two details from Python's behavior are worth knowing so the node doesn't surprise you:

    • The first character, not the first word. "hello world""Hello world". Only the very first char gets uppercased; the rest of the sentence stays lowercase. If you wanted every word capitalized, that's the title node's job.
    • Non-letters don't trigger uppercase. If the string starts with a digit or symbol, the first letter won't be capitalized - "3d render" stays "3d render" (lowercase d). It's a known Python quirk, and it will confuse you exactly once.

    Inputs and output

    • string (STRING, default "") - the text to capitalize.
    • STRING (output) - the capitalized result.

    That's the entire schema: one required input with an empty-string default, one string output. There's genuinely nothing else to configure.

    Installing

    It's part of Basic data handling by StableLlama. ComfyUI Manager - search "Basic data handling", install, restart - is the fastest route. Manual install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
    

    Restart ComfyUI after either path. The pack declares no dependencies and downloads no models, so this is a clean, instant install that can't conflict with your other custom nodes.

    Common issues

    The only real gotcha is the two quirks above: it's not title-case, and it won't capitalize past a leading digit or symbol. If the output looks "wrong," check which of those you hit - and if you need every word capitalized, use title instead. Otherwise this node is about as failure-proof as the pack gets: nothing to break, nothing to tune.

    CategoryBasic/STRING

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING