ComfyUI Node

istitle

Istitle — checking that every word behaves and capitalizes like it should

By StableLlama·Created about a year ago·Updated 4 days ago· 48
istitle
    • BOOLEAN
    string

    Title case is the format everyone thinks they have until they generate it with a script and it comes back as "Hello World", "hello world", and "HELLO WORLD" on three different runs. istitle is the node that tells you which one you actually got. It returns a real BOOLEAN answering "is this string titlecased?" - every word starting with an uppercase character and continuing with lowercase.

    You'd reach for it to verify output before it becomes a filename, a UI label, or a value that gets written somewhere permanent. It's also useful as a QA gate on text that comes from elsewhere - confirming a generated caption or an API field actually arrived titlecased before you trust it downstream.

    How it works

    Python's str.istitle(). A titlecased string has each word starting uppercase and continuing lowercase, with at least one character total. Punctuation and digits are ignored as word separators. The behavior is exact and a little ruthless:

    • "Hello World"True
    • "Hello World!"True (punctuation doesn't break it)
    • "Hello world"False (second word isn't capitalized)
    • "HELLO WORLD"False (all caps isn't titlecase)
    • "HelloWorld"False (one long word, not two)
    • "Don't"False
    • ""False

    That last one is the subtle trap. "Don't" is not titlecased in Python's eyes, because the apostrophe splits it into two words, and the second word - t - starts lowercase. People building filenames from titles hit this constantly.

    Inputs and outputs

    One required input, string (default ""), and one BOOLEAN output. The output branches a conditional: on True pass the string through, on False route it into this pack's capitalize or title node to fix it up.

    Installing it

    Ships in the Basic data handling pack by StableLlama. Install with ComfyUI Manager (search "Basic data handling") or manually:

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

    Restart ComfyUI. Zero dependencies, no model downloads - the pack is pure Python, which is exactly why it appears in shared workflows without needing its own installation saga. The node is under Basic/STRING/is.

    Common issues

    The apostrophe problem above is the one that'll actually bite. "Don't", "It's", "Mama's" all fail istitle even though any human would call them titlecased. If your data has contractions or possessives, either normalize them first or use this as "is this strictly titlecased" rather than "is this good enough". Also note it's all-or-nothing per word - a single lowercase word anywhere in the string flips the whole thing to False, which is correct but means half-corrected strings fail loudly. That's the point, honestly: it tells you the truth so your conditional can finish the job.

    CategoryBasic/STRING/is

    Inputs (1)

    NameTypeDefaultDescription
    stringSTRING

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN