Split Text
Cut a string into parts without losing the leftovers
- part_1
- part_2
- part_3
- part_4
- part_5
Split Text is the general-purpose knife in StringKit: give it a string, a delimiter, and it hands you up to five named parts. It's what you reach for when one line of text is really two or three fields - a prompt with a title slapped on the front, a config line, a list you're parsing by hand. It exists because the ComfyUI way to split strings is "figure it out yourself," and this does it without any Python in the graph.
The default delimiter is %, and that's a sensible default here: plenty of packs pack a prompt like sunset%50%cloudy sky and % never appears in normal prose. But the real trick is max_parts.
The input that saves your data
- text - what you're splitting (multi-line, accepts links).
- delimiter - the separator. You can write escape notation:
\n,\t,\r,\\all mean their literal characters, so you can split on newlines from a widget. - max_parts - 1 to 5, and this is the one to understand. The split stops early: any delimiter beyond
max_partsis left inside the last part, not discarded. Split"sunset%a 50% cloudy sky"with%atmax_parts=2and you getpart_1="sunset",part_2="a 50% cloudy sky"- the%inside the body survives. Crank it to 5 and you get three pieces instead. For splitting a title from a body, leave it at 2. - strip_whitespace - on by default; trims each part so
" sunset "doesn't carry its padding.
Unused parts come out as empty strings, so a downstream node never sees None. Leave the delimiter blank and the whole string lands untouched in part_1.
Where it fits
The honest answer is: Split Text is the boring-but-reliable node you use twice and forget. Its sibling Titled Text / Unpack Text pair does the title-splitting job more safely (no delimiter to collide with), so Split Text earns its keep parsing other people's packed formats - comma or pipe-delimited tag lists, imported config strings, anything where the format isn't yours to control.
Install
Ships in ComfyUI-StringKit - MIT, zero dependencies, no models. Install from ComfyUI Manager (search ComfyUI-StringKit) or:
cd ComfyUI/custom_nodes
git clone https://github.com/luku756/ComfyUI-StringKit
Restart ComfyUI completely afterward (frontend JS needs a full reload, not a hot one). It's under the StringKit category. There's genuinely nothing heavy here - it's a few lines of split with a maxsplit guard, and that guard is exactly why you should trust it with data you don't want to lose.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| delimiter | STRING | % | — |
| max_parts | INT | 51–5 | — |
| strip_whitespace | BOOLEAN | true | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| part_1 | STRING | — |
| part_2 | STRING | — |
| part_3 | STRING | — |
| part_4 | STRING | — |
| part_5 | STRING | — |