XStringGroup
Five prompts in, one out — switch style variants without rewiring anything
- total_string
- selected_string
- string_1
- string_2
- string_3
- string_4
- string_5
Prompts in ComfyUI tend to accumulate in ugly ways: a CLIP Text Encode for the subject, a second one for the style, a third for the negative, and suddenly the workflow is a tangle of text boxes and reroutes. XStringGroup takes a different approach - up to five multiline strings in one node, with a separator of your choice between each, and it hands you back both the combined result and whichever single string you select.
The killer feature is the selector. You can park five different style variants (or five negative-prompt candidates) in one node and flip between them with a dropdown instead of pasting text around the graph. That's a workflow-level A/B test without touching any connections.
How it works
It's a dumb concatenator with guard rails. Each pair of strings gets a separation_method combo: none, newline, space, comma, comma_space, period, or period_space. The node joins string_1 through string_5 in order with the chosen separators between them - no clever merging, just exact concatenation with exactly the separator you picked.
select_string is a combo from "1" to "5" that picks which input gets passed through as selected_string. The node validates the selection rather than crashing on a bad index, which is the kind of thing you only appreciate when a shared workflow hands it a stale value.
The inputs that matter
- select_string - the dropdown that chooses which of the five strings becomes
selected_string. - string_1 … string_5 - the five multiline inputs.
- separation_method_1_2 … separation_method_4_5 - the joiner between each adjacent pair. If you only use two strings, leave the later methods at "none" and they'll contribute nothing.
The outputs
Seven of them, which is a lot, but only two really matter:
- total_string - all five joined with their separators. This is what feeds your CLIP Text Encode for the positive prompt.
- selected_string - whichever one you picked with the selector.
- string_1 … string_5 - pass-through copies of each original input, so you can route one of them elsewhere without adding reroutes.
A common pattern: string_1 holds the subject, string_2 the style, string_3 quality tags, with comma_space between them, and total_string becomes "subject, style, quality". Then a second XStringGroup or a switch selects between three negative prompts for testing.
Installing
Ships in ComfyUI-Xz3r0-Nodes. ComfyUI Manager → search "ComfyUI-Xz3r0-Nodes" → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Xz3r0-M/ComfyUI-Xz3r0-Nodes.git
cd ComfyUI-Xz3r0-Nodes
pip install -r requirements.txt
Restart ComfyUI. No models to fetch; the only Python dependency in the pack is ffmpeg-python and this node never touches it.
Gotchas
- The separators are exact. "comma" gives
,with no space; "comma_space" gives,. Mixing them up is the #1 way to get prompts that read likedog,cat,birdwhen you meantdog, cat, bird. select_stringonly changesselected_string-total_stringalways contains all five, so empty slots contribute empty text (plus whatever separator precedes them). If string_2 is empty and the 1_2 separator is "space," you get a leading space. Set unused separators to "none" to avoid stray junk.- The original inputs all pass through as outputs, so it doubles as a small organizer even if you never use
total_string.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| select_string | COMBO | 1 | Select which string to output (1-5) |
| string_1 | STRING | First multiline string input | |
| separation_method_1_2 | COMBO | none | Separation method between String 1 and String 2 (none: '', newline: \n, space: ' ', comma: ',', comma_space: ', ', period: '.', period_space: '. ') |
| string_2 | STRING | Second multiline string input | |
| separation_method_2_3 | COMBO | none | Separation method between String 2 and String 3 (none: '', newline: \n, space: ' ', comma: ',', comma_space: ', ', period: '.', period_space: '. ') |
| string_3 | STRING | Third multiline string input | |
| separation_method_3_4 | COMBO | none | Separation method between String 3 and String 4 (none: '', newline: \n, space: ' ', comma: ',', comma_space: ', ', period: '.', period_space: '. ') |
| string_4 | STRING | Fourth multiline string input | |
| separation_method_4_5 | COMBO | none | Separation method between String 4 and String 5 (none: '', newline: \n, space: ' ', comma: ',', comma_space: ', ', period: '.', period_space: '. ') |
| string_5 | STRING | Fifth multiline string input | |
| none_on_empty | BOOLEAN | true | When enabled, output None if all strings are empty; when disabled, output empty string instead |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| total_string | STRING | Output of all grouped strings (with separation methods) |
| selected_string | STRING | Selected string output based on select_string |
| string_1 | STRING | Original output of String 1 |
| string_2 | STRING | Original output of String 2 |
| string_3 | STRING | Original output of String 3 |
| string_4 | STRING | Original output of String 4 |
| string_5 | STRING | Original output of String 5 |