Compare Text
Equal, startswith, endswith as a clean boolean
- BOOLEAN
Compare Text (StringCompare) checks two strings against each other - are they equal, or does one start with / end with the other - and returns a single boolean. It's the literal, pattern-free cousin of Match Text, and it's how you make a workflow branch on what its text is rather than what it contains.
The routing uses are obvious once you see them: an LLM node that returns either a valid prompt or "I can't do that" - check Equal against the failure string and route accordingly. A model name that ends in -turbo - Ends With to pick the right sampler path. A prompt that starts with a negative marker - Starts With to split negative from positive processing. Where RegexMatch asks "does it match a pattern anywhere," this node asks "is it, literally, this thing (or anchored at one end)." No metacharacters, no escaping - what you type is what gets compared.
How it works
The mechanism is Python's string comparisons - a == b, a.startswith(b), a.endswith(b) - selected by the mode dropdown. Inputs:
- string_a and string_b - the two texts being compared. In Starts With / Ends With modes, the question is "does string_a start/end with string_b?" Order matters.
- mode - the dropdown: Equal, Starts With, Ends With. No "contains," no "less than" - those live in other nodes (StringContains for contains).
- case_sensitive - defaults to true. And note the contrast with the regex family: those default to case-insensitive, this one defaults to case-sensitive. Two adjacent text nodes with opposite defaults is exactly the kind of thing that bites at 2am, so check it.
Output: a single BOOLEAN. True when the comparison holds, false otherwise.
A quick example of it in the wild: model-name routing. Your workflow loads either model-sd15 or model-sdxl, and the sampler path needs to differ. Ends With with string_a = the model name and string_b = "sdxl" gives you the boolean that picks the branch - no regex, no substring ambiguity, no case surprises once the toggle is set. Same shape handles prompt classification: Starts With to detect a known command prefix before a handler node. It's the least glamorous node in the string family, and it's the one that keeps routing logic honest.
Common issues
Two traps. First, the default case-sensitivity: "Cat" and "cat" are not equal until you flip the toggle - and since it's the opposite default from RegexMatch, people swap between the nodes and get confused about why behavior flipped. Second, Starts With/Ends With compare string_a against string_b in that order - wire them backwards and every check silently returns false. Also worth knowing: the comparison is exact-literal, so trailing whitespace or a stray newline in either multiline field breaks equality - a case-convert or trim pass before comparing is the standard hygiene. If you need contains rather than equals/prefix/suffix, that's the sibling Contains Text node; together they cover the common "what is this string?" checks.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| string_a | STRING | — | |
| string_b | STRING | — | |
| mode | COMBO | 3 options: Starts With, Ends With, Equal | |
| case_sensitive | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |