Nodes/ComfyUI-string-util/String Not Equal
ComfyUI Node

String Not Equal

The 'is different' check, when difference is the interesting case

By kale4eat·Created 2 years ago·Updated 2 years ago· 7
String Not Equal
    • bool
    s1
    s2

    String Not Equal is the inverted twin of String Equal: it returns True when two strings differ and False when they match. When your workflow's interesting path is the one where text changed, or where an input isn't the expected value, this is the node that hands you the signal without an inverter in the middle.

    What it is

    It runs Python's s1 != s2. Exact comparison, same rules as its sibling: every character counts, case is case, whitespace is whitespace. "draft" vs "Draft" returns True (they differ); "draft" vs "draft" returns False.

    The natural use is change detection and fail-fast logic. "If the mode string isn't quality, use the fast settings." "If this generated text isn't what I expected, stop before spending a generation." Because the boolean comes out directly, you can wire it straight into a switch or conditional node without adding a NOT in between - which is exactly why the pack ships both directions rather than telling you to negate.

    The inputs and outputs

    • s1 (STRING) - first string.
    • s2 (STRING) - second string.
    • bool (BOOLEAN) - True if s1 and s2 are not equal.

    That's the whole node. If you want the equality case instead, that's String Equal.

    How to install it

    Same dependency-free pack as everything else here:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kale4eat/ComfyUI-string-util
    

    or search "ComfyUI-string-util" in ComfyUI Manager and restart. It lives under the string-util category.

    Common issues

    Same two gotchas as String Equal, because it's the same comparison. Case sensitivity: "Draft" != "draft" is True, which may be the wrong answer if you meant "same word, different case." Normalize both sides with String Upper or String Lower first. Whitespace: a trailing space makes two strings that look identical compare as different - run them through String Strip if there's any chance of stray whitespace. Two prep nodes, and the "unexpectedly different" results stop.

    Categorystring-util

    Inputs (2)

    NameTypeDefaultDescription
    s1STRING
    s2STRING

    Outputs (1)

    NameTypeDescription
    boolBOOLEAN