Nodes/ComfyUI-KYNode/Join any into string
ComfyUI Node

Join any into string

Stitch mixed-type values into one string without cast nodes

By yorkane·Created 2 years ago·Updated 6 months ago· 10
Join any into string
  • any1
  • any2
  • any3
  • prefix+all-text+suffix
  • prefix+any1+gap+suffix
  • prefix+any2+gap+suffix
prefix
any1_any2_gap
any2_any3_gap
suffix

Building a dynamic filename or caption out of a few pieces - a prefix, a couple of values from earlier in the graph, a suffix - usually means chaining several "convert to string" and "concatenate" nodes together. This one collapses that into a single node: wire in up to three values of any type, set your separators, and get a joined string back, plus a couple of partial builds along the way.

Inputs and outputs

Every input on this node is optional, which is a little unusual for something that's fundamentally about combining values - you can run it with nothing wired and just get prefix + suffix (empty strings by default, so effectively nothing) back. The full set: prefix (STRING), any1 (wildcard), any1_any2_gap (the separator string placed between any1 and any2), any2 (wildcard), any2_any3_gap (the separator between any2 and any3), any3 (wildcard), and suffix (STRING).

Three outputs, and this is the detail worth reading the schema carefully for: prefix+all-text+suffix (everything joined together, the one you'll use most often), prefix+any1+gap+suffix (just any1, wrapped in its own prefix/suffix/gap), and prefix+any2+gap+suffix (the same, but for any2). Notice what's missing - there's no third output wrapping any3 on its own. Whether that's intentional or just how it shipped isn't explained anywhere, but it's exactly what the schema shows, so if you need any3 wrapped independently, you'll have to build that with a second KY_JoinToString (or your own prefix/suffix) rather than expecting a fourth output here.

Where this fits

Pairs naturally with anything that hands back a mix of typed values - a KY_BBoxToXYWH unpacking into ints, an LLM caption node's string output, a frame index from a loop - where you want them stitched into one readable string for a filename, a log line, or a caption file, without manually casting each one first.

Installing it

ComfyUI Manager: search ComfyUI-KYNode, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/yorkane/ComfyUI-KYNode

Restart ComfyUI. No external dependencies - pure string formatting.

Common issues

Since everything is optional, a typo'd or forgotten connection doesn't error - it just quietly contributes nothing to the joined string. If your output is missing a piece you expected, check the actual wire, not the node's logic; there's no required-input validation here to catch a dropped connection for you.

Remember any3 only shows up in the combined prefix+all-text+suffix output, not in a dedicated wrapped output of its own - if a downstream node is only reading prefix+any2+gap+suffix expecting it to also carry any3's value, that's the mismatch to check first.

Wildcard typing means this node will stringify essentially anything you hand it - a whole tensor, a dict, a list - without complaint, but the resulting string representation of a complex object (a raw Python repr()-style dump, most likely) probably isn't the human-readable text you actually want in a filename or caption. Keep any1/any2/any3 to genuinely string-friendly values - numbers, short strings, booleans - if the output needs to be readable.

CategoryKYNode/Utils

Inputs (7)

NameTypeDefaultDescription
prefixoptSTRING
any1opt*
any1_any2_gapoptSTRING
any2opt*
any2_any3_gapoptSTRING
any3opt*
suffixoptSTRING

Outputs (3)

NameTypeDescription
prefix+all-text+suffixSTRING
prefix+any1+gap+suffixSTRING
prefix+any2+gap+suffixSTRING