Comes after
Ordering strings so a workflow can sort
- result
"Comes after" is the string-comparison node that answers a question most workflow builders never think to ask: does one string sort after another? It's first > second on text - true when the first string comes later in dictionary order. On the surface that sounds like trivia for a string-ordering nerd. In practice it's how you make a workflow that sorts, ranges, or buckets text without a single line of code.
It's part of the string-comparison family in marco-zanella's ComfyUI-BooleanExpression pack, a dependency-free logic collection. Its display name is "Comes after", and its class name is BooleanExpression.StringComparison.AlphabeticalGreaterThan - one of those "display name says the friendly thing, class name says the math thing" situations.
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. The mechanism is Python's built-in string comparison, which orders by Unicode code point - effectively alphabetical for plain text, which is why the pack calls these "alphabetical" nodes.
Honest nuance: "alphabetical" is a slight marketing upgrade. Python string ordering is lexicographic by code point, which matches dictionary order for plain ASCII text but diverges for mixed case or accented characters - e.g. "Z" < "a" because uppercase letters sort before lowercase in the code-point table. With case_insensitive on (the default), lowercasing first makes the ordering behave like a real dictionary for typical use. For "banana" vs "apple", this returns true - banana comes after apple.
When you'd actually use it
String ordering is niche but real: routing based on name ranges ("titles in the N–Z range get the premium settings"), bucketing tags, or sanity-checking that two labels were sorted the way you expect. It composes with the rest of the pack's string comparisons - the classic bucket workflow uses Comes before, Comes after, and the equal-to nodes together to split a list of names into bands. It's a node you'll go weeks without touching and then need exactly once.
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
- Case-insensitive by default. Flip the toggle if you need byte-exact ordering. For dictionary-style behavior, leave it on - that's where the "alphabetical" claim actually holds.
- It's code-point order, not a language collation. "Comes after" won't match how your operating system's file manager sorts filenames (those use locale-aware collation). For ASCII text you're fine; for exotic Unicode, expect surprises.
- Both branches downstream still compute. Like every node in the pack, it produces a value, not a path - unselected input chains of any downstream Conditional Branch still run. Free for strings.
If you're building anything that sorts or ranges over text, this is the node. If you just need "are these strings the same," grab the string "Equal to" instead - Comes after is for when order actually matters.
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 | — |