join(3tcl)
π join β bestie edition π
okay so this is the join page from the Tcl Built-In Commands manual, and honestly? it's a little icon. it takes a list and smushes it into one string. that's it. that's the whole vibe. β¨
πΈ NAME πΈ
join β make a string by gluing list elements together π«Ά
β¨ SYNOPSIS β¨
join list ?joinString?
π DESCRIPTION π
so the list argument has to be a valid Tcl list β no cap, that's non-negotiable, it will simply not work otherwise π
this command hands you back a string, and that string is made by joining all of the elements of list together, with joinString sitting between each adjacent pair of elements. like a little friendship bracelet where the string is the beads and the glue is the... okay the metaphor fell apart but you get me π
and the joinString argument? it defaults to a space character. so if you don't pass one, space is what you get. periodt. β
π¦ EXAMPLES π¦
making a comma-separated list β the classic, the moment, the slay:
set data {1 2 3 4 5}
join $data ", "
β 1, 2, 3, 4, 5
using join to flatten a list by a single level β not me flattening my whole life π:
set data {1 {2 3} 4 {5 {6 7} 8}}
join $data
β 1 2 3 4 5 {6 7} 8
π₯ SEE ALSO π₯
list(3tcl)β the list girlies, we love herlappend(3tcl)β append erasplit(3tcl)β join's chaotic opposite, she takes strings APART π
π KEYWORDS π
element, join, list, separator
this page is brought to you by Tcl, and yes bestie, it lives at join(3tcl) in the Tcl Built-In Commands manual β go off, you're gonna use this constantly ππ
π¦ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- Copyright (c) 1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms