ComfyUI Node

Does not end with

Skip the pass you don't need

By marco-zanella·Created about a year ago·Updated about a year ago· 0
Does not end with
    • result
    haystack
    needle
    case_insensitivetrue

    Here's a workflow thought that only makes sense as a negative: "only run the heavy post-processing if this output is not a preview." You don't want to check what something is - you want to exclude what it isn't. That's the entire personality of this node.

    Does not end with comes from ComfyUI-BooleanExpression, Marco Zanella's zero-dependency logic pack. It's the negated twin of Ends with: same two strings, same case_insensitive toggle, one flipped answer. It returns true when the first string does not finish with the second, and false when it does. From the source, it's literally not haystack.endswith(needle).

    How it works

    The inputs are the familiar trio:

    • haystack - "The string."
    • needle - "The string to search."
    • case_insensitive - defaults to True.

    Case folding on by default means "DRAFT.PNG" does not end with ".png"... no, wait - it does not end with... let me be careful: with case-insensitivity on, "DRAFT.PNG" endswith ".png" is true, so this node returns false. That's the behavior you want for extension checks in the wild, where case is a coin flip. If you need ".png" and ".PNG" to be different, turn it off.

    Output is a single result boolean, wired into the pack's Conditional Branch, the And/Or/Xor/Not nodes, or any BOOLEAN input.

    Where it earns its keep

    • Skip-the-final-pass logic: filename doesn't end with _final → skip the second upscale. This is the classic "don't waste the GPU" guard, and it reads more honestly than an EndsWith wrapped in a Not.
    • Format exclusions: everything except .webp gets the alpha-preserving path.
    • Branch hygiene: when your condition is "do this unless the name signals done," a node that says exactly that keeps the graph legible.

    Honestly, for a lot of people this node is redundant - EndsWith + Not does the same math. But the negated twins in this pack exist because ComfyUI graphs are read left-to-right, and "Does not end with" is clearer at a glance than a stray Not node that future-you will misread as a bug. That clarity is the product here, and it costs nothing.

    Install

    ComfyUI Manager: search ComfyUI-BooleanExpression, install, restart. Or:

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

    Restart ComfyUI, then find it under Boolean Expressions → String Comparisons. The pack has no Python dependencies (empty requirements.txt) and downloads no models - install is clone-and-restart, and it's registered with the Comfy Registry so Manager resolves it by name.

    CategoryBoolean Expressions/String Comparisons

    Inputs (3)

    NameTypeDefaultDescription
    haystackSTRINGThe string.
    needleSTRINGThe string to search.
    case_insensitiveBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    resultBOOLEAN