Comes before or equal to
The boundary, included
- result
"Comes before or equal to" is the inclusive side of the string-ordering family: first <= second, true when the first string sorts earlier or is identical to the second. It exists for the same reason the arithmetic comparisons have inclusive variants - because "up to here" usually includes the boundary. A strict "comes before" silently drops the edge case, and this node exists so your range keeps its boundary names.
It's part of marco-zanella's ComfyUI-BooleanExpression pack, a dependency-free logic collection. Display name "Comes before or equal to," class name BooleanExpression.StringComparison.AlphabeticalLessThanOrEqualTo. It's the mirror of "Comes after or equal to," and the two of them together define the inclusive edges of a string range.
How it works
Three required inputs:
first- the first string (default empty)second- the second string (default empty)case_insensitive- a BOOLEAN toggle, defaulting totrue
Output is result, a BOOLEAN: first <= second on the (optionally lowercased) strings. Mechanism is Python's <= - lexicographic comparison by Unicode code point. Lowercasing first when case_insensitive is on makes the ordering read like a real dictionary for plain text; leave it on unless you need byte-exact comparison.
The "or equal to" is the entire reason this node exists. The strict "Comes before" is false for identical strings; this one is true. So when you're building a range like "everything from the start through M," the M itself has to be included - and that's precisely the inclusive case.
The range pattern
Pair it with "Comes after" (or "Comes after or equal to") to carve a sorted list of names into bands with no gaps and no double-counting. "A through M" is Comes-before-or-equal-to on the top end and something like Comes-after (strict) on the bottom; the boundary names land exactly where you intend. It's niche, but the day your workflow needs to bucket text, you'll be glad the inclusive edge exists instead of stacking an equals check manually.
Installing it
No models, no dependencies, pure Python - the pack's requirements.txt is empty. ComfyUI Manager, search ComfyUI-BooleanExpression, or:
cd ComfyUI/custom_nodes
git clone https://github.com/marco-zanella/ComfyUI-BooleanExpression.git
Restart ComfyUI, and it's under Boolean Expressions → String Comparisons.
Gotchas
- Inclusive is the point. Identical strings return
truehere andfalseon "Comes before." If a bucket loses its top boundary name, you used the strict node. - Case-insensitive by default. Flip for byte-exact ordering. Also not locale-aware collation, so don't expect your OS file manager's sort order on exotic Unicode.
- Both branches downstream still compute. Value-producing node, not control flow - unselected chains upstream still run. Free for strings.
It's a thin utility and you'll reach for it mostly as the "up to and including this" half of a string range. When you need that boundary included, it's the correct tool - and now you know why the "or equal to" is in the name rather than an afterthought.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| first | STRING | The first string. | |
| second | STRING | The second string. | |
| case_insensitive | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | BOOLEAN | — |