String Splitter (Soze)
Break a string into two pieces on one delimiter
- string1
- string2
A deliberately small tool: it splits input_string into exactly two pieces around split_string. Not a list, not an arbitrary number of parts - two outputs, always. That shapes what it's good for: "split once" jobs, not "explode this into every piece."
How it works
With only two outputs available, it can only be dividing on the first occurrence of your delimiter - if split_string shows up more than once in input_string, expect string2 to still contain everything after that first hit, delimiter and all, rather than getting split further. Think of it the way Python's str.split(sep, 1) behaves, not str.split(sep).
The inputs and outputs that matter
- input_string - the text to split.
- split_string - the delimiter to split on.
Outputs are string1 (everything before the delimiter) and string2 (everything after). If your delimiter isn't found at all, you'll most likely get the whole input back in string1 and an empty string2 - which is actually a handy side effect: treat an empty string2 as a lightweight signal that the split didn't find anything, without needing a separate Text Contains check first.
Where it fits
Beyond peeling apart filenames, this shows up naturally anywhere text arrives as one blob that's really two logical pieces glued together with a known separator. A LoRA's trigger-word block that's stored as "trigger, rest of description" - split on ", " and you've isolated the trigger word in string1 without hand-editing the text every time. Or a config line stored as key=value - split on "=" and route string1/string2 to wherever the key and value actually need to go. If you're building this kind of thing on top of a Load Random Line From Text File output, String Splitter is usually the very next node in the chain.
Installing it
ComfyUI Manager: search ComfyUI_Soze. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/SozeInc/ComfyUI_Soze.git, pip install -r ComfyUI_Soze/requirements.txt, restart. Pure string handling, nothing else to install.
Common issues
The obvious use case is peeling a prefix off a structured filename - split "1234_subject.png" on "_" to separate the index from the descriptive part. Where people trip up is expecting it to behave like a full tokenizer for anything with the delimiter appearing multiple times; it won't give you a third or fourth piece. If you genuinely need more than two segments, chain a second String Splitter onto string2 and split again.
Also worth knowing: this node splits, it doesn't validate. It won't tell you your delimiter choice was ambiguous or warn you that a filename had two underscores instead of one - it just does the one split it's built to do and hands you whatever falls out. If your output looks wrong, the fastest debugging step is a Preview node on both string1 and string2 so you can see exactly where the cut landed before you assume the node itself is broken.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_string | STRING | — | |
| split_string | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| string1 | STRING | — |
| string2 | STRING | — |