Nodes/ComfyUI Easy Use/easy mathString
ComfyUI Node Runs on cloud

easy mathString

Compare two strings and get a boolean

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
easy mathString
    • BOOLEAN
    a
    b
    operation
    case_sensitivetrue

    The name is a little misleading - this isn't doing arithmetic. It's easy compare's string-focused cousin: two text inputs go in, an operator picks how to compare them, and a boolean comes out. If you've got a workflow that needs to branch based on text - does this string match that one, does a wildcard-populated prompt contain a keyword, did an API response come back with an expected value - this is the node that turns that question into a true/false you can feed into easy ifElse.

    Why you'd reach for it

    Text-driven branching comes up more than you'd expect once you're building anything automated: checking whether a loaded filename matches a pattern before processing it, gating a step based on a tag showing up in a caption an image-to-text node produced, or validating that a value coming back from an API node matches what you expected before you spend compute on the rest of the graph. easy compare's wildcard inputs can technically handle strings, but a dedicated string node gives you comparison behavior actually built for text - including the case-sensitivity control below, which a generic equality check wouldn't give you.

    How it works

    You give it two strings, a and b, pick an operation from the dropdown, and toggle whether the comparison should care about letter case. It evaluates the comparison and returns the boolean result.

    The inputs and outputs that matter

    • a / b - the two strings to compare.
    • operation - a dropdown of string-comparison operations. The specific list of choices isn't something we're pinning down here - open the dropdown on the node itself to see exactly what's on offer, since string-comparison nodes across this ecosystem commonly include things like equals, contains, or starts/ends-with, but the exact set on this particular node is worth checking directly rather than assuming.
    • case_sensitive (default true) - flip this off if you want "Cat" and "cat" to be treated as equal instead of different.

    Output: a single BOOLEAN. Wire it into easy ifElse, a switch, or anywhere else that consumes a condition.

    Installing it

    Ships with the base pack. ComfyUI Manager: search ComfyUI Easy Use, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yolain/ComfyUI-Easy-Use
    

    then install.bat on Windows or pip install -r requirements.txt, restart. No models, no extra dependencies.

    Common issues & troubleshooting

    Comparison doesn't match what you expected. Before assuming the node's broken, check case_sensitive - it defaults to true, so "Prompt" and "prompt" are different values unless you flip it off. This is the single most common reason a "should be equal" comparison comes back false.

    Whitespace or hidden characters throwing off an equality check. If one of your strings came from a text field a user typed into, or from an upstream node that added a trailing newline or extra space, an otherwise-identical-looking pair of strings can fail an exact match. If you're seeing unexpected false results on strings that look the same, strip or trim the values before comparing (a string-cleanup node ahead of this one) rather than assuming this node's logic is at fault.

    Not sure which operation to pick. Since the exact operator list isn't something to guess at from outside the node, the fastest way to know is to open the dropdown on the node in your own ComfyUI install and read the options directly - it'll be faster and more reliable than any description here.

    CategoryEasyUse/Logic/Math

    Inputs (4)

    NameTypeDefaultDescription
    aSTRING
    bSTRING
    operationCOMBO6 options: a == b, a != b, a IN b, a MATCH REGEX(b), a BEGINSWITH b, a ENDSWITH b
    case_sensitiveBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN