ComfyUI Node

Equal to

Equal strings, without the case drama

By marco-zanella·Created about a year ago·Updated about a year ago· 0
Equal to
    • result
    first
    second
    case_insensitivetrue

    String equality is where a lot of ComfyUI conditional workflows go to die. Two prompts look identical, a name comparison keeps returning false, and you discover "Sora" and "sora" are not the same string. The "Equal to" node from the string-comparison half of marco-zanella's ComfyUI-BooleanExpression pack sidesteps the worst of it: it compares strings case-insensitively by default. "Sora" and "sora" are equal here, which is almost always what you actually meant.

    How it works

    Three required inputs:

    • first - the first string (default empty)
    • second - the second string (default empty)
    • case_insensitive - a BOOLEAN toggle, defaulting to true

    Output is result, a BOOLEAN: first == second. When case_insensitive is on (the default), both strings are lowercased before comparing. That default is the single most useful thing about this node - you get tolerant string matching without doing the lowercasing yourself.

    Where it shines: routing on labels and names. "If the checkpoint name is 'anything but this exact label', take a different path." Comparing a loaded prompt to a known string, checking whether a tag matches a sentinel, deduplicating names in a workflow that takes user text input. Any time the question is "are these two strings the same thing, ignoring capitalization."

    Installing it

    No models, no dependencies, pure Python - the pack's requirements.txt is empty. ComfyUI Manager, search ComfyUI-BooleanExpression, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/marco-zanella/ComfyUI-BooleanExpression.git
    

    Restart ComfyUI, and it's under Boolean Expressions → String Comparisons. Note it shares the display name "Equal to" with the arithmetic version - if you search for it, look for the one in the String Comparisons section (the class name is BooleanExpression.StringComparison.AlphabeticalEqualTo).

    Gotchas

    • Case-insensitive is the default, not opt-in. If you genuinely need "Sora" ≠ "sora" (say, matching a filename that's case-sensitive), flip case_insensitive off. Most people want it on; it's just worth knowing which way the default leans.
    • Whitespace and accents still count. This lowercases; it doesn't trim or normalize. "sora " (trailing space) is not equal to "sora", and accented characters compare by Unicode value. That's normal string behavior, but it surprises people once.
    • "Alphabetical" is a slight overclaim. This uses Python's plain string equality - fine for exact matching. For "comes before/after" ordering, that's the sibling nodes' job, and their "alphabetical" framing is similarly loose (it's Unicode code-point order, which is almost alphabetical for plain text).
    • Both branches downstream still compute. Chain into a Conditional Branch and the unselected chain upstream runs anyway. Free for strings.

    For the loose, human-friendly "are these the same label" check, this is the node. For strict byte-exact matching, flip the toggle and keep the trailing-space paranoia.

    CategoryBoolean Expressions/String Comparisons

    Inputs (3)

    NameTypeDefaultDescription
    firstSTRINGThe first string.
    secondSTRINGThe second string.
    case_insensitiveBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    resultBOOLEAN