diff options
Diffstat (limited to 'doc/join.n')
-rw-r--r-- | doc/join.n | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/join.n b/doc/join.n new file mode 100644 index 0000000..1b23667 --- /dev/null +++ b/doc/join.n @@ -0,0 +1,44 @@ +'\" +'\" Copyright (c) 1993 The Regents of the University of California. +'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.so man.macros +.TH join n "" Tcl "Tcl Built-In Commands" +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +join \- Create a string by joining together list elements +.SH SYNOPSIS +\fBjoin \fIlist \fR?\fIjoinString\fR? +.BE +.SH DESCRIPTION +.PP +The \fIlist\fR argument must be a valid Tcl list. +This command returns the string +formed by joining all of the elements of \fIlist\fR together with +\fIjoinString\fR separating each adjacent pair of elements. +The \fIjoinString\fR argument defaults to a space character. +.SH EXAMPLES +.PP +Making a comma-separated list: +.PP +.CS +set data {1 2 3 4 5} +\fBjoin\fR $data ", " + \fB\(-> 1, 2, 3, 4, 5\fR +.CE +.PP +Using \fBjoin\fR to flatten a list by a single level: +.PP +.CS +set data {1 {2 3} 4 {5 {6 7} 8}} +\fBjoin\fR $data + \fB\(-> 1 2 3 4 5 {6 7} 8\fR +.CE +.SH "SEE ALSO" +list(n), lappend(n), split(n) +.SH KEYWORDS +element, join, list, separator |