Text List to String
Turn a list of strings into one string without a headache
- text_list
- text
Lots of nodes hand you a list of strings. Almost nothing lets you glue that list back into a single string with the formatting you want. Text List to String is the missing join operation: it takes any list, wraps each item in a prefix and suffix you choose, and joins the whole thing with a separator. Three fields, one string out, done.
The inputs
- text_list - the list to merge. It's typed
*, so it accepts any list of anything; each item gets stringified. It'll even flatten one level of nesting if someone hands you a list-of-lists. - prefix / suffix - applied to every item individually, not to the whole result. That's the subtle part and the reason this node is more useful than it looks:
prefix="--",suffix=","on a list of keywords gives you a comma-separated, prefixed block ready for a wildcard or a prompt. - separator - the glue between items, default
\n(newline). Escape sequences are decoded, so you can type\n,\t, or\rliterally and get real whitespace, and\\ngets you a literal backslash-n when you need one.
Output: text, a single STRING with everything joined.
Why you'd reach for it
The prompt-engineering angle is the big one. ComfyUI has a bunch of list-producing text nodes - custom string lists, seed lists, multi-line parsers - and prompts usually want one flat string. Feed a list of styles or subjects in, join with , , and you've got a prompt line you can pass straight to a CLIP encoder. It's equally good for building filenames from a list of parts, assembling a metadata block, or turning a list of paths into a text log.
Installing it
ComfyUI Manager, search "ComfyUI 1hewNodes", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
Restart after either. Like every node in this pack, the install cost is shared: the repo's requirements.txt drags in heavy detection/background-removal deps (rembg, ultralytics, transformers) that this text node will never touch.
Gotchas
The escape-sequence decoding trips people: a separator of \n becomes an actual newline, so if you wanted the two-character sequence \n literally, you need to type \\n. And since it joins with no smart handling of the last item, a trailing separator is your responsibility - with separator , , "a, b, c, " is what you asked for, comma included. For a list-to-string that treats the whole block as one item rather than per-item formatting, look at the pack's Text Prefix Suffix instead - different tool for a slightly different job.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| prefix | STRING | — | |
| suffix | STRING | — | |
| separator | STRING | \n | — |
| text_listopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |