join(3tcl)

join3tcl

Create a string by joining together list elements

Usage

join list ?joinString?


    


    


    

Overview

The list argument must be a valid Tcl list. This command returns the string formed by joining all of the elements of list together with joinString separating each adjacent pair of elements. The joinString argument defaults to a space character.

Examples

Making a comma-separated list:

set data {1 2 3 4 5}
join $data ", "
     → 1, 2, 3, 4, 5

Using join to flatten a list by a single level:

set data {1 {2 3} 4 {5 {6 7} 8}}
join $data
     → 1 2 3 4 5 {6 7} 8

Keywords

element, join, list, separator

Releases

18 releases since Debian 1.1 (Buzz); the text changed 10 times.

  1. 1.1–1.3
  2. 2.0
  3. 2.1
  4. 2.2–3.0
  5. 3.1–4.0
  6. 5.0
  7. 6.0
  8. 7
  9. 8–9
  10. 10
  11. 11–13

From tcl8.6-doc 8.6.16+dfsg-1 in Debian 13 (Trixie). Also shipped by tcl9.0-doc. Parsed by carta from the page's man source.