XStringWrap
The node that adds the commas you're tired of typing
- wrapped_text
XStringWrap is a tiny utility node that wraps a piece of text in a prefix and/or suffix separator. That's the whole job. It sounds trivial, and it is - which is exactly why it's handy when you're assembling prompts from parts and are sick of deciding whether the space goes before or after the comma.
You feed it a text string, pick a separator for the front and one for the back, and it returns the text wrapped in those. Think of it as the punctuation node for people who build prompts out of building blocks.
How it works
There are five inputs:
- enabled - a master toggle. Off means the output is an empty string, full stop.
- apply_mode -
both(prefix + suffix),prefix_only, orsuffix_only. - prefix_separator / suffix_separator - combos with the same options as its sibling node XStringGroup: none, newline, space, comma, comma_space, period, period_space.
- text - the multiline string being wrapped.
The behavior is deliberately simple: if enabled is off or the text is empty, output is empty. Otherwise it concatenates prefix + text + suffix according to the apply mode. There's no escaping logic, no smart quote handling - it's literal concatenation, which is what you want from a node like this.
The output is a single wrapped_text STRING.
Why you'd use it
Mostly it exists to keep other parts of your graph clean. Two quick examples:
- You want a "photo of" prefix applied conditionally - wire a boolean into
enabled, set prefix to "space", and the node quietly adds "photo of " only when the toggle is on. - You're joining several prompt components and want to control punctuation at each junction without hand-editing every string. A comma here, a newline there, all managed in one place.
It also plays nicely with its sibling XStringGroup: use XStringWrap to normalize punctuation around individual components, then XStringGroup to join them into a final prompt. One wraps, one groups.
Installing
It's part of 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
Then restart ComfyUI. Nothing to download, no models, no special runtime requirements.
Gotchas
- If
textis empty, you get an empty string even withenabledon - the node doesn't emit bare separators. That's deliberate and usually what you want, but it surprises people who expect a stray comma. - The separator combos are exact strings; "comma" and "comma_space" are different. Check which one you picked before blaming the node.
- It's a genuinely thin node. If you only need to join a couple of fixed strings, XStringGroup does the same job with more control - reach for XStringWrap when you want the toggle or the single-field simplicity.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| enabled | BOOLEAN | true | Enable output; if disabled, output is None |
| apply_mode | COMBO | both | Separator apply mode (both: prefix+suffix, prefix_only: only prefix, suffix_only: only suffix) |
| prefix_separator | COMBO | none | Prefix separator before text (none: '', newline: \n, space: ' ', comma: ',', comma_space: ', ', period: '.', period_space: '. ') |
| text | STRING | Main text to wrap | |
| suffix_separator | COMBO | none | Suffix separator after text (none: '', newline: \n, space: ' ', comma: ',', comma_space: ', ', period: '.', period_space: '. ') |
| none_on_empty | BOOLEAN | true | When enabled, output None if text is empty; when disabled, output empty string instead |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| wrapped_text | STRING | Wrapped string output |