✂️ String Text Splitter
Break a string on its first delimiter, or pull specific chunks
- first_chunk
- remainder
- chunk_list
- targeted_chunks
Splits a string once, at the first time a delimiter shows up - not every occurrence, just the first - and hands you both halves. The node's own example is the clearest way to explain it: input part1|part2|part3 with delimiter | gives first_chunk = part1 and remainder = part2|part3.
How it works
delimiter is the character to split on. split_at_linebreaks additionally splits at line breaks, and can be used with or without a delimiter set at all. target_indices lets you skip past "just the first split" entirely and instead pull specific chunks out by position - a comma-separated, 0-based list like 0,2 grabs the first and third chunk after the string has been fully split.
Note that first_chunk/remainder only ever reflect the first delimiter hit, no matter how many times the delimiter actually appears in the string - for a string with three or more segments, those two outputs alone won't give you the whole picture, which is exactly what chunk_list is for.
The inputs and outputs that matter
input_string- the text to split, multiline.delimiter- the character to split on at its first occurrence.split_at_linebreaks(defaultfalse) - also split on line breaks, independent ofdelimiter.target_indices(optional, default empty) - comma-separated 0-based indices to pull out specifically; leave empty to ignore.
Outputs: first_chunk (before the first delimiter), remainder (everything after it), chunk_list (the full split into all pieces, as a list), and targeted_chunks (a multiline string of whatever target_indices picked out).
How to install it
Via ComfyUI Manager: search ComfyUI-mnemic-nodes, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes
Restart ComfyUI. No model downloads or extra dependencies.
Common issues & troubleshooting
You need every piece, but only got two outputs. first_chunk and remainder deliberately only reflect the first split - if your string has more than two segments and you need all of them, that's chunk_list, not the first two outputs.
target_indices returns nothing. It's a plain comma-separated list of numbers, 0-based - a typo, an index past the end of your actual chunk count, or leaving it as the default empty string (which means "ignored") will all come back empty rather than throwing an error. Double-check the index count against how many pieces chunk_list actually produced.
A real use case: breaking apart a tagged single-line value like style|subject|mood from an earlier node, or splitting a multi-line LLM response into indexed pieces you can route to different downstream nodes without writing a Python script to do it. split_at_linebreaks specifically is the one to reach for on multi-paragraph LLM output where each line is its own logical chunk.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| input_string | STRING | The input text to split. | |
| delimiter | STRING | The character to split the text on. The node will split at the first time this character appears. | |
| split_at_linebreaks | BOOLEAN | false | If true, also split at line breaks. Can be used with or without a delimiter. |
| target_indices | STRING | Comma-separated list of indices (0-based) of chunks to extract. E.g., '0,2' for the first and third chunk. Leave empty to ignore. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| first_chunk | STRING | The part of the string before the first delimiter. |
| remainder | STRING | The remainder string after the first delimiter. |
| chunk_list | STRING | A list of all items split by the delimiter. |
| targeted_chunks | STRING | A multiline string of chunks at the specified target indices. |