String contains v5.1.0
The tiny contains-checker that unblocks your branching
- BOOLEAN
Some nodes solve hard problems. This one solves a dumb one that's been annoying you for weeks: "does this text contain that text?" String contains is a five-line substring check wrapped in a ComfyUI node, and it's the kind of utility you don't miss until you need it - then suddenly you're routing prompts, filename suffixes and API responses through it.
It's from tri3d-comfyui-nodes (TRI3D-LC, v5.1.0), and it's about as simple as a node gets. Two strings in, one boolean out.
How it works
The whole implementation is:
input_lower = input_string.lower()
search_lower = search_string.lower()
contains = search_lower in input_lower
That's it - a case-insensitive Python substring test. "VERSION" matches "version", "SDXL" matches "sdxl", and there's no regex, no wildcards, no starts-with. If you need search_string to appear at a specific spot, that's not this node.
The inputs that matter
input_string(multiline) - the text you're searching inside. Wire in a prompt, a filename, a loaded text file.search_string- the needle, default empty.
Output is a single BOOLEAN. That's what you feed into a Switch/IF-style node (Impact Pack, rgthree, or a simple boolean router) to change behavior mid-graph.
The classic setup: load a prompt file, check it for a keyword like "nsfw" or "portrait", and route the graph down different branches based on the result. It also shines with the file-reading nodes in the same pack - check the contents of a text file, then branch.
Install
ComfyUI Manager → search tri3d-comfyui-nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes
Restart ComfyUI. No dependencies beyond the Python standard library - this node can't fail to install.
Gotchas
One real footgun: an empty search_string always returns True, because "" in anything is True in Python. If you leave the needle blank you'll silently take the "yes" branch every time. Worth stating plainly because the default is empty. Also, it's case-insensitive by design but whitespace-sensitive - "sdxl " with a trailing space will not match "sdxl". Trim your inputs if you're checking filenames. Otherwise there's genuinely nothing to troubleshoot: it's a substring check, and it does what it says.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_string | STRING | — | |
| search_string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |