| Line | |
|---|
| 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 | '\" RCS: @(#) $Id: join.n,v 1.9 2007/12/13 15:22:32 dgp Exp $ |
|---|
| 9 | '\" |
|---|
| 10 | .so man.macros |
|---|
| 11 | .TH join n "" Tcl "Tcl Built-In Commands" |
|---|
| 12 | .BS |
|---|
| 13 | '\" Note: do not modify the .SH NAME line immediately below! |
|---|
| 14 | .SH NAME |
|---|
| 15 | join \- Create a string by joining together list elements |
|---|
| 16 | .SH SYNOPSIS |
|---|
| 17 | \fBjoin \fIlist \fR?\fIjoinString\fR? |
|---|
| 18 | .BE |
|---|
| 19 | |
|---|
| 20 | .SH DESCRIPTION |
|---|
| 21 | .PP |
|---|
| 22 | The \fIlist\fR argument must be a valid Tcl list. |
|---|
| 23 | This command returns the string |
|---|
| 24 | formed by joining all of the elements of \fIlist\fR together with |
|---|
| 25 | \fIjoinString\fR separating each adjacent pair of elements. |
|---|
| 26 | The \fIjoinString\fR argument defaults to a space character. |
|---|
| 27 | .SH EXAMPLES |
|---|
| 28 | Making a comma-separated list: |
|---|
| 29 | .CS |
|---|
| 30 | set data {1 2 3 4 5} |
|---|
| 31 | \fBjoin\fR $data ", " |
|---|
| 32 | \fB\(-> 1, 2, 3, 4, 5\fR |
|---|
| 33 | .CE |
|---|
| 34 | .PP |
|---|
| 35 | Using \fBjoin\fR to flatten a list by a single level: |
|---|
| 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 | |
|---|
| 42 | .SH "SEE ALSO" |
|---|
| 43 | list(n), lappend(n), split(n) |
|---|
| 44 | |
|---|
| 45 | .SH KEYWORDS |
|---|
| 46 | element, join, list, separator |
|---|
Note: See
TracBrowser
for help on using the repository browser.