join(n)

πŸ“¦
version 9.0.3 Β· 3 versions
, in alpine 3.23, alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ join(n) β€” Tcl Built-In Commands ✨

okay bestie, welcome to the join page from the Tcl Built-In Commands manual πŸ’– this one's short, it's sweet, it's a total baddie, and you're gonna be obsessed.


πŸŽ€ NAME πŸŽ€

join β€” create a string by joining together list elements 🫢


🌸 SYNOPSIS 🌸

join list ?joinString?

πŸ’… DESCRIPTION πŸ’…

okay so. the list argument must be a valid Tcl list β€” like, that's not optional, that's the vibe check it has to pass 🌈

this command returns the string you get by joining all of the elements of list together, with joinString sitting between each adjacent pair of elements. think of it as the glue, the ribbon, the little separator doing the most between your faves πŸ’–

and the joinString argument? it defaults to a space character. so if you don't hand it one, it just quietly puts spaces in there. lowkey iconic behavior honestly.


πŸ¦‹ EXAMPLES πŸ¦‹

making a comma-separated list, because who doesn't love that:

set data {1 2 3 4 5}
join $data ", "
     β†’ 1, 2, 3, 4, 5

using join to flatten a list by a single level β€” one level only, don't get carried away:

set data {1 {2 3} 4 {5 {6 7} 8}}
join $data
     β†’ 1 2 3 4 5 {6 7} 8
see how {6 7} stayed all bundled up? yeah. single level. periodt πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘


🌈 KEYWORDS 🌈

element, join, list, separator


that's the whole page bestie, no cap, it really is that simple πŸ’œ

this little cutie lives in the Tcl manual as join(n) β€” go forth and join things, you got this πŸŽ€βœ¨πŸ¦‹πŸ’–πŸŒΈπŸ«Ά

πŸ“¦ where this page comes from