Nodes/ComfyUI Ino Nodes/Ino String Length
ComfyUI Node

Ino String Length

Character counting for people who don't want to count

By nobandegani·Created about a year ago·Updated 2 months ago· 6
Ino String Length
    • length
    input_string

    Sometimes the most useful thing a node can tell you about a string is how long it is. Ino String Length does exactly that: one input, one length output, no settings to fiddle with. It's the kind of trivial utility that feels pointless until the moment your workflow needs it.

    The input is input_string, and the output is an INT with the character count. Empty string gives you 0, and - this is the part beginners trip over - it counts characters, not words. "hello world" is 11, not 2. If you're trying to count tokens, this isn't that; it's raw character length.

    When it earns its keep

    • Truncation checks. Prompt or caption too long for something downstream? Compare length against a threshold and branch on it.
    • Validation gates. Flag empty strings before they flow into a node that can't handle them - an empty string is length 0, which is a clean, checkable signal.
    • Seed/noise from text. Feed the length into a InoRandomIntInRange or use it as a cheap deterministic seed for variations. Text-driven variation is a real pattern, and length is a handy stable input for it.

    Being a pure function with an INT output, it wires straight into anything that takes a number - comparators, switches, math. Pair it with InoCompareInt and you have a "is this prompt longer than N characters" check with zero effort.

    Installing Ino Nodes

    It's part of the Ino pack, so install once, get it plus 125 siblings. ComfyUI Manager: search "ComfyUI Ino Nodes", install, restart. Terminal:

    cd ComfyUI/custom_nodes
    git clone https://github.com/nobandegani/ComfyUI-InoNodes.git
    cd comfyui_ino_nodes
    pip install -r requirements.txt
    

    Requires the pack's inopyutils dependency in ComfyUI's Python environment; V3-schema pack, so keep ComfyUI current. Nothing else to configure.

    Where people get burned

    Roughly nowhere - it's a one-line function. The only recurring confusion is the character-vs-word thing and the fact that it counts every character including spaces and punctuation. If a "10 character" check is rejecting strings that look fine, that's the reason.

    CategoryInoStringHelper

    Inputs (1)

    NameTypeDefaultDescription
    input_stringSTRING

    Outputs (1)

    NameTypeDescription
    lengthINT