Text Compare
Branch your workflow on what the text says
- result
- result_text
"Does this prompt contain 'watercolor'?" "Does this filename start with 'final'?" "Is this tag equal to that one?" Text Compare answers questions like that and hands you a boolean you can wire into a switch, gate, or conditional string node. It's the text-flavored sibling of the pack's Number Compare - the if-statement for strings.
It's part of DebugPadawan's ComfyUI Essentials, a pure-Python utility pack. The comparisons are plain Python string operations; no models, no GPU, nothing to download beyond the repo.
How it works
Three required inputs:
text_a- the string being examined (multiline-friendly)text_b- the string being tested against itmode- the dropdown with five options:equals,not equals,contains,starts with,ends with
One optional input:
case_sensitive- BOOLEAN, default True. Turn it off to compare case-insensitively (it lowercases both sides before comparing).
Two outputs:
result- the BOOLEAN answerresult_text- the same answer as the string"True"/"False"
The direction matters for contains, starts with, and ends with: they all test text_b against text_a. So for "does text_a contain text_b?", text_a is the haystack and text_b is the needle. Get them backwards and contains silently returns False.
Where you'll use it
- Conditional prompt handling. If a wildcard injected "cinematic", route the workflow down a different branch.
- Filename/tag checks. Gate a save or a style pass on whether a string starts with or contains a marker.
- Case-insensitive matching. Compare tags that might differ in case (
"Flux"vs"flux") by flippingcase_sensitiveoff. - Feeding
Logic Gate. Combine several text checks with AND/OR/NOT for richer conditions.
Installing it
Whole pack, one install. ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
Then restart ComfyUI. Requirements (numpy, torch, opencv-python) are already satisfied by stock ComfyUI; no model downloads. When searching Manager, don't confuse it with cubiq's "ComfyUI Essentials" - a different, larger pack now in maintenance mode.
Gotchas
- Argument order.
contains/starts with/ends withalways testtext_bintext_a. Wire them backwards and you'll chase a phantom bug. case_sensitiveaffects every mode, includingequals- with it off,"Hello"equals"hello".- Whitespace is not trimmed.
"watercolor "with a trailing space does not equal"watercolor". If you're comparing raw user/wildcard text, trim or normalize first (the pack has aText Trimnode). - It returns a BOOLEAN; a
result_textstring is there for display/debug convenience. - Small, quiet pack - the source is the documentation.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text_a | STRING | — | |
| text_b | STRING | — | |
| mode | COMBO | equals | 5 options: equals, not equals, contains, starts with, ends with |
| case_sensitiveopt | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| result | BOOLEAN | — |
| result_text | STRING | — |