Nodes/comfyui-jk-easy-nodes/JK String Equals
ComfyUI Node

JK String Equals

Compare two strings, get a boolean to branch on

By kostenickj·Created 2 years ago·Updated 2 years ago· 8
JK String Equals
    • BOOLEAN
    a
    b

    Exactly what it says: two string inputs in, one BOOLEAN out - true if they match, false if they don't. It's the string-comparison building block ComfyUI's node graph doesn't give you natively; you need it as an actual node so its output can drive a Switch, a gate, or any other node that branches on a boolean.

    The inputs and outputs that matter

    Two required inputs, a and b, both STRING. One output, BOOLEAN. There's no case-sensitivity toggle, no trim-whitespace option - it's a direct comparison, so if you need a case-insensitive match, normalize both strings (lowercase them) upstream before they reach this node.

    Where this actually gets used

    The obvious use in this pack's own context is checking a mode setting before branching a workflow - for instance, comparing a text value against a known constant to decide which of two paths a generation should take, without hand-writing that logic in a Python-based node. If a value you want to compare didn't start out as text - a widget, a number, an object from another pack - run it through JKAnythingToString first to force it into a string this node can actually take.

    For the inverse check, this pack ships JKStringNotEquals as a direct counterpart, so you don't need to bolt a NOT node onto this one's output if what you actually want is "these are different."

    It's also a reasonable stand-in for validation in a template workflow you're sharing with someone else - comparing an input against an expected constant before letting a heavier, slower branch (a detailer pass, an upscale) run, so a typo or a wrong setting fails fast on a cheap check instead of quietly producing the wrong output twenty steps later after burning GPU time on the expensive part of the graph.

    Installing it

    Bundled with the rest of kostenickj/jk-comfyui-helpers - no way to install just this node on its own. It's already present on comfy.icu, or for a self-hosted setup: cd ComfyUI/custom_nodes && git clone https://github.com/kostenickj/jk-comfyui-helpers.git, then restart ComfyUI. Pure logic, no models, no extra Python dependencies - once the pack is installed, this node just works. The README notes ComfyUI Manager registration was pending at the time it was written, so a manual clone is the dependable install path; git pull in that folder to update. As with the rest of this pack, it's a small, low-traffic personal toolkit - don't expect much community discussion if something looks off, the node's own behavior is your reference.

    Common issues

    There's genuinely very little to go wrong with a two-string comparison. The trap worth knowing: this is a strict, literal comparison - trailing whitespace, differing capitalization, or a stray newline will make two strings that "look" the same to you register as unequal to this node. If a comparison you expect to be true keeps coming back false, run both values through JKAnythingToString or a text preview node and look carefully for whitespace or casing differences before assuming the node is broken.

    CategoryJK Comfy Helpers/Util

    Inputs (2)

    NameTypeDefaultDescription
    aSTRING
    bSTRING

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN