String Compare
Compare two strings and get a boolean — read the fine print first
- Result
String Compare does what it says: take two strings, apply a comparison, hand back a boolean. It's a five-minute node to understand, and it's exactly what you want when a workflow needs to branch on whether two texts are equal or which one sorts first. Just be aware what "greater than" means for text before you trust it.
How it works
Three inputs, one output. a and b are plain string fields; op is a dropdown with six choices: GT, LT, GTE, LTE, EQUAL, NOTEQUAL - greater than, less than, greater-or-equal, less-or-equal, equal, not equal. The output is a single boolean named Result.
The comparison itself is Python's native string ordering, which is lexicographic: it compares character by character using code points, like a dictionary sorts words. "apple" < "banana", "abc" < "abd". That's the useful version of text comparison, and it's what you want when you're comparing version tags, filenames, or categories.
The fine print
Lexicographic is not numeric. The string "10" is less than "9" because "1" sorts before "9". If you're comparing seed values or step counts that arrive as text, string comparison will lie to you. Convert to numbers first (the same pack's String to Int exists for exactly this), or accept that you're ordering text, not values.
Also note the input fields are plain string widgets, not force-input - so you can type values in directly, which makes this handy as a quick inline condition in a workflow.
Where you'd reach for it
Branching logic, mostly. Compare a prompt to a known tag to decide which path to take. Check whether two strings that should be identical (a filename and a filename you expected) actually match. NOTEQUAL is the quiet workhorse for "is this field empty of meaningfully different from my default?" - pair the boolean with a switch or conditional node and you've got real control flow in the graph.
Install
It's part of the ComfyUI-TinyBee pack. ComfyUI Manager: search ComfyUI-TinyBee → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
It sits under 🐝TinyBee/Casting. No dependencies beyond the standard library - the pack's pillow/jsonata requirements are for its image and JSON nodes.
Gotchas
Beyond the numeric-vs-lexicographic trap, note the case sensitivity: "Cat" and "cat" are unequal, and there's no case-insensitive option on this node - you'd have to normalize the strings elsewhere first. And equal-length strings that are equal up to the shorter one's length still compare as not equal; "abc" vs "abc " (trailing space) are different strings. Strings are picky; feed them clean data.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | STRING | — | |
| b | STRING | — | |
| op | COMBO | EQUAL | 6 options: GT, LT, GTE, LTE, EQUAL, NOTEQUAL |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Result | BOOLEAN | — |