分隔符拆分两边🐠meeeyo.com
Split a string in two at the first delimiter you give it
- STRING
- STRING
SplitStringByDelimiter is the two-output workhorse of the MeeeyoAI/ComfyUI_StringOps pack: it cuts a string at the first occurrence of a delimiter and hands you the left half and the right half as two separate STRING outputs. That's it - but that one operation quietly powers a lot of prompt plumbing.
Think of every place your text is really two values joined by a separator. "positive prompt | negative prompt". "subject, style" in a key-value line. A filename like scene_042. This node separates them so each half can go to a different destination.
The inputs
- input_string - the text to split (default
文本|内容, just a demo value in Chinese). - delimiter - the separator, default
|.
The outputs
Two STRINGs: the part before the first delimiter, and the part after it. Three details matter:
- It splits on the first occurrence only.
a|b|cgives youaandb|c- the right side can still contain the delimiter. If you want the right side split further, chain a second instance. - If the delimiter never appears, the whole string comes back as the first output and the second is an empty string. No error, no warning - just an empty port. That silent behavior is the most common thing to trip over.
- The delimiter is matched literally, not as a regex. No escaping surprises for ordinary separators.
The default | is a good habit - it's what the rest of this pack uses everywhere (its filter and batch-replace nodes all treat | as a list separator), so splitting on | keeps you compatible with the pack's conventions.
When to reach for it
It's the natural partner for the pack's other string nodes. Use it to peel the label off a key|value line before sending the value to a CLIP text encode; split a "positive|negative" packed field so the two halves feed separate encoders; or break a path apart to grab a filename component. It's also a cheap way to get a "does this delimiter exist at all?" signal - an empty second output tells you it didn't.
It's not for multi-way splitting. Need three or more pieces? That's a job for the pack's line-based extractors or a different tool entirely. This one is strictly a two-halves node.
Installing
Same as every node in the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git
or via ComfyUI Manager searching ComfyUI_StringOps, then restart. It shows up under "Meeeyo/String". No models, no extra dependencies beyond a stock ComfyUI.
It's a thin node - essentially split(delimiter, 1) with a fallback - but thin and predictable is a feature in a graph tool. There's exactly one thing to remember: no delimiter in the input, and the second output is silently empty.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_string | STRING | 文本|内容 | — |
| delimiter | STRING | | | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |
| STRING | STRING | — |