Nodes/JNComfy/Text Concatenation
ComfyUI Node

Text Concatenation

Glue strings together without a text node in sight

By jn-jairo·Created 2 years ago·Updated 2 years ago· 5
Text Concatenation
  • values
  • STRING
glue

Building prompts out of parts is one of the most common chores in ComfyUI, and it's usually done by hand - typing the same boilerplate into every CLIP Text Encode node. JN_TextConcatenation automates it: feed it any number of values, it joins them into one string, and you wire that string into your text encoders. It's the string version of "add inputs until you run out," which is to say it handles a dynamic number of parts without you pre-deciding the count.

How it works

The values input is the pack's dynamic multiple type - start with one slot, connect things, and new slots appear (that's multipleInputs.js doing its thing). On each run it flattens any arrays, converts every value to a string with str(), drops the None ones (so unconnected slots just vanish), and joins the rest with the glue string.

  • glue - the separator. Empty (default) joins with nothing: "foo" "bar""foobar". Set it to ", " for a comma list, " " for a space-separated tag string, "\n" for multiline.
  • values - the dynamic pile. Any type works, because JNComfy enables the generic * input. Numbers become "42", booleans become "True" - that's just str().

Output is a plain STRING, which is exactly what a CLIP Text Encode node wants on its text input.

Where you'd use it

Prompt assembly is the obvious one. Keep your style tokens, subject fragments, and quality tags in separate primitive strings or arrays, concatenate them with the right glue, and drive several text encoders from the same built prompt. It's also great for building filenames and paths on the fly - date + subject + resolution all wired together - and for joining tag lists that came out of an array.

It pairs well with the pack's other text tools: JN_TextReplace to clean up whatever you joined, or the primitive conversions if a value needs coercing before it reads nicely. And since values can be arrays, you can concatenate a whole list of fragments in one go rather than chaining nodes.

Install

It's part of JNComfy, installed once for the whole pack. ComfyUI Manager → search "JNComfy" → Install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/jn-jairo/jn_comfyui

restart, and pip install -r requirements.txt inside the folder if you're not using Manager. Like the other Primitive/Process nodes it's dependency-free pure Python; the heavy install list belongs to the pack's audio and face-restore sections.

Gotchas

  • glue is a plain separator, not a template - there's no {placeholder} magic. If you need templating, build it with multiple concatenations or JN_TextReplace.
  • Everything goes through str(), so a float becomes "3.5" and a numpy value becomes something ugly. Coerce numbers with the primitive conversion nodes first if the output has to be clean.
  • Unconnected slots vanish silently (they're None-filtered). If you were expecting a fixed number of parts and one isn't connected, you'll get a shorter string with no error. That's usually what you want, but it can mask a missing wire.
CategoryJN/Primitive/Process

Inputs (2)

NameTypeDefaultDescription
glueoptSTRING
valuesopt*

Outputs (1)

NameTypeDescription
STRINGSTRING