String Split
Slice a prompt or filename into a list you can actually use
- list
String Split takes one string and cuts it into a list, which sounds trivial until you realize how much of ComfyUI hands you strings in shapes you don't want. A multi-line prompt that you want to process line by line. A filename with a path you want to separate from the extension. A metadata string of comma-separated tags. Split is the knife.
It's dead simple: a string goes in, a delimiter tells it where to cut, and a list comes out the other side. The default delimiter is \n, so out of the box it turns a multi-line prompt into a list of lines - which is exactly the most common need, because that's how a lot of the ecosystem delivers tag lists and prompt blocks.
The inputs that matter
- string - what to cut up. It's
force_input, meaning it must be wired - there's no typing in a value and running it standalone. That's intentional: the node exists to process strings that come from elsewhere. - delimiter - the cut point, default
\n. You can split on\tfor tabs,,for comma-separated lists,|for pipe-separated, or any literal string. The escape handling is user-friendly: typing\nin the widget means newline,\tmeans tab - no fighting backslash escaping in the UI. - trim - a boolean, off by default. Turn it on and each part gets leading/trailing whitespace stripped after splitting. This is the one beginners forget, and it's usually the difference between a clean list and a list of
["hair", " beach", "sunset"]where the middle item has a stray space that breaks string comparisons downstream.
Output is the list - a STRING-typed list, which wires straight into String Join for round-tripping, or into nodes that consume string lists.
What it's actually for
The killer pattern is split → process → join. Split a prompt on newlines, run String Compare on individual lines ("does any line say this character name?"), then String Join with \n to reassemble the prompt. That's prompt surgery without touching the sampler. It also shines on filenames: split on . or / to pull a filename apart, check the extension, and branch the pipeline based on whether the loaded file is an image or a video.
Installing it
Part of Nifty Nodes for ComfyUI (Stibo/comfyui-nifty-nodes). Easiest via ComfyUI Manager - search "Nifty Nodes" - or clone:
cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes
Restart after. The pack is built on the v3 API (comfy_api.latest), so it needs a current ComfyUI; on anything older the whole pack refuses to load. No extra pip packages or model downloads for the string nodes.
One honest note
If you're splitting a string you typed yourself just to inspect it, you probably don't need this node - a Show Text / Preview Any node will do. Split earns its place when the string is produced by the graph: a dynamic prompt result, a loader's metadata, a filename. That's when you're stuck with a string in a shape you didn't choose, and Split is the cheapest way to take it apart.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | The string to split. | |
| delimiter | STRING | \n | Character or string to split on. Use \n for newline, \t for tab. |
| trim | BOOLEAN | false | Trim leading and trailing whitespace from each part after splitting. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| list | STRING | — |