summaryrefslogtreecommitdiffstats
path: root/doc/split.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-10-17 10:22:24 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-10-17 10:22:24 (GMT)
commit842e3ff91428c72a2ce0d4df4889778af82f4b12 (patch)
tree5a94240e321022019f593f6bd712833ab12138c6 /doc/split.n
parent8b464633a0f2df93912ad25af65a5724cd643da2 (diff)
downloadtcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.zip
tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.gz
tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.bz2
Improve clarity of formatting.
Diffstat (limited to 'doc/split.n')
-rw-r--r--doc/split.n16
1 files changed, 10 insertions, 6 deletions
diff --git a/doc/split.n b/doc/split.n
index 4defc5c..ef5470b 100644
--- a/doc/split.n
+++ b/doc/split.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: split.n,v 1.10 2007/12/13 15:22:33 dgp Exp $
+'\" RCS: @(#) $Id: split.n,v 1.11 2008/10/17 10:22:25 dkf Exp $
'\"
.so man.macros
.TH split n "" Tcl "Tcl Built-In Commands"
@@ -16,7 +16,6 @@ split \- Split a string into a proper Tcl list
.SH SYNOPSIS
\fBsplit \fIstring \fR?\fIsplitChars\fR?
.BE
-
.SH DESCRIPTION
.PP
Returns a list created by splitting \fIstring\fR at each character
@@ -31,34 +30,41 @@ If \fIsplitChars\fR is an empty string then each character of
\fIstring\fR becomes a separate element of the result list.
\fISplitChars\fR defaults to the standard white-space characters.
.SH EXAMPLES
+.PP
Divide up a USENET group name into its hierarchical components:
+.PP
.CS
-\fBsplit\fR "comp.lang.tcl.announce" .
- \fI\(-> comp lang tcl announce\fR
+\fBsplit\fR "comp.lang.tcl" .
+ \fI\(-> comp lang tcl\fR
.CE
.PP
See how the \fBsplit\fR command splits on \fIevery\fR character in
\fIsplitChars\fR, which can result in information loss if you are not
careful:
+.PP
.CS
\fBsplit\fR "alpha beta gamma" "temp"
\fI\(-> al {ha b} {} {a ga} {} a\fR
.CE
.PP
Extract the list words from a string that is not a well-formed list:
+.PP
.CS
\fBsplit\fR "Example with {unbalanced brace character"
\fI\(-> Example with \e{unbalanced brace character\fR
.CE
.PP
Split a string into its constituent characters
+.PP
.CS
\fBsplit\fR "Hello world" {}
\fI\(-> H e l l o { } w o r l d\fR
.CE
.SS "PARSING RECORD-ORIENTED FILES"
+.PP
Parse a Unix /etc/passwd file, which consists of one entry per line,
with each line consisting of a colon-separated list of fields:
+.PP
.CS
## Read the file
set fid [open /etc/passwd]
@@ -80,9 +86,7 @@ foreach rec $records {
puts "$longName uses [file tail $shell] for a login shell"
}
.CE
-
.SH "SEE ALSO"
join(n), list(n), string(n)
-
.SH KEYWORDS
list, split, string