Character In Text
Find where a substring sits inside a block of text
- INT
This is a plain substring search, dressed up as a node: hand it a block of text and a character (or substring - the field is multiline, so it's not limited to one letter), and it tells you the index at which that substring first turns up, searching from wherever you tell it to start. Nothing fancy - it's glue, not a feature on its own.
Where it earns its keep is in the rest of this pack's text/LLM/TTS tooling. Mixlab ships GPT chat nodes, text-to-speech, and a "DynamicDelayByText" node that paces execution based on how long a chunk of text takes to speak. Locating punctuation or a specific marker character inside generated text - to slice it into sentence-sized chunks, or to drive some downstream index/branch logic - is exactly the kind of small utility that pipeline needs, and CharacterInText is that utility.
How it works
You give it text to search, character to look for, and a start_index to search from (so you can call it again after the first hit to find the next occurrence). It returns the position as a plain integer.
The inputs and outputs that matter
text(STRING, multiline, required) - the text you're searching inside.character(STRING, multiline, required) - what you're looking for. Despite the name, this isn't restricted to a single character - it's a substring match.start_index(INT, default1, range0–1024, required) - where the search begins. Push this forward past a previous hit if you're scanning for repeat occurrences.
The single output is INT - the index where the match was found. Wire it into whatever index-driven logic you're building downstream (a slice, a comparison, a counter).
How to install it
Ships with the Mixlab pack.
- ComfyUI Manager: search
comfyui-mixlab-nodes, install, restart. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/shadowcz007/comfyui-mixlab-nodes.git, install requirements (install.baton Windows, or../../../python_embeded/python.exe -s -m pip install -r requirements.txt), restart.
Pure text utility, no model downloads.
Common issues & troubleshooting
Not sure what happens when the character isn't found. The schema doesn't spell out a documented "not found" value, so don't assume a particular fallback (like -1) without checking your own workflow's behavior first - test with a character you know is present in your text before wiring this into anything that branches on the result.
start_index is bigger than the text. If you're scanning past the end of the string on a second pass, expect an out-of-range result rather than a graceful "no match" - keep your start_index sane relative to the actual length of text.
Looking for a whole phrase, not a letter. That's fine - character is multiline and takes any substring, not literally one character. The node name undersells it a bit.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| character | STRING | — | |
| start_index | INT | 10–1024 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |