Shima String Splitter
Split a string into a list plus eight named outputs at once
- LIST
- count
- S1
- S2
- S3
- S4
- S5
- S6
- S7
- S8
Sometimes the string is already the wrong shape. You've got a comma-separated tag list from a tagger or a wildcard, and you need it as individual values - one per wire. Shima StringSplitter does exactly that split, and it hedges its bets by giving you three ways to consume the result: a full LIST, a count, and up to eight fixed S1–S8 string outputs.
That triple-output design is the interesting choice. A plain str.split gives you one list and nothing else; this node recognizes that different consumers want different shapes. Wire the LIST into something batch-oriented, or wire S2 directly into a prompt box because you only care about the second tag.
The inputs
text- the string to split.delimiter- default",". Note: unlike StringConcat's comma-space, this uses the literal delimiter with no whitespace handling, which is why there's a separate trim option.use_regex- default off. Flip it on and the delimiter becomes a regex pattern (re.split). This is the escape hatch for multi-character or complex delimiters -",\\s+"handles "comma plus any whitespace" in one pass.trim_whitespace- default on. Strips each piece so"a, b, c"yields"a","b","c"rather than" b".
Outputs: LIST (a Python list of all pieces), count (how many pieces), and S1–S8. Two details matter. The list and count reflect the full split, while the named outputs are capped at eight - anything beyond the eighth is only reachable through the LIST. And the named slots are padded with empty strings when fewer than eight pieces exist, so S8 on a three-tag input is "", not an error or a missing port.
Installing it
Part of KDB-USJP/shima_wf:
cd ComfyUI/custom_nodes
git clone https://github.com/KDB-USJP/shima_wf
Restart ComfyUI. No extra dependencies.
The honest advice
Turn on use_regex only when you actually need it - a malformed regex is caught and it falls back to returning the whole text as one piece, which is a silent surprise if you were expecting several. The realistic gotcha is the delimiter/trim interaction: with trim_whitespace on and a plain "," delimiter, "a,b" and "a, b" both split cleanly; turn trimming off and you'll be passing " b" around with a leading space. If your downstream prompt box suddenly has stray spaces, that's the setting. For the common case - tag list in, individual tags out - it's a workhorse.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| delimiter | STRING | , | — |
| use_regex | BOOLEAN | false | — |
| trim_whitespace | BOOLEAN | true | — |
Outputs (10)
| Name | Type | Description |
|---|---|---|
| LIST | LIST | — |
| count | INT | — |
| S1 | STRING | — |
| S2 | STRING | — |
| S3 | STRING | — |
| S4 | STRING | — |
| S5 | STRING | — |
| S6 | STRING | — |
| S7 | STRING | — |
| S8 | STRING | — |