| 1 |
'\" |
| 2 |
'\" Copyright (c) 1993 The Regents of the University of California. |
| 3 |
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 4 |
'\" |
| 5 |
'\" See the file "license.terms" for information on usage and redistribution |
| 6 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 7 |
'\" |
| 8 |
.TH join n "" Tcl "Tcl Built-In Commands" |
| 9 |
.so man.macros |
| 10 |
.BS |
| 11 |
'\" Note: do not modify the .SH NAME line immediately below! |
| 12 |
.SH NAME |
| 13 |
join \- Create a string by joining together list elements |
| 14 |
.SH SYNOPSIS |
| 15 |
\fBjoin \fIlist \fR?\fIjoinString\fR? |
| 16 |
.BE |
| 17 |
.SH DESCRIPTION |
| 18 |
.PP |
| 19 |
The \fIlist\fR argument must be a valid Tcl list. |
| 20 |
This command returns the string |
| 21 |
formed by joining all of the elements of \fIlist\fR together with |
| 22 |
\fIjoinString\fR separating each adjacent pair of elements. |
| 23 |
The \fIjoinString\fR argument defaults to a space character. |
| 24 |
.SH EXAMPLES |
| 25 |
.PP |
| 26 |
Making a comma-separated list: |
| 27 |
.PP |
| 28 |
.CS |
| 29 |
set data {1 2 3 4 5} |
| 30 |
\fBjoin\fR $data ", " |
| 31 |
\fB\(-> 1, 2, 3, 4, 5\fR |
| 32 |
.CE |
| 33 |
.PP |
| 34 |
Using \fBjoin\fR to flatten a list by a single level: |
| 35 |
.PP |
| 36 |
.CS |
| 37 |
set data {1 {2 3} 4 {5 {6 7} 8}} |
| 38 |
\fBjoin\fR $data |
| 39 |
\fB\(-> 1 2 3 4 5 {6 7} 8\fR |
| 40 |
.CE |
| 41 |
.SH "SEE ALSO" |
| 42 |
list(n), lappend(n), split(n) |
| 43 |
.SH KEYWORDS |
| 44 |
element, join, list, separator |