diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-17 10:22:24 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-10-17 10:22:24 (GMT) |
commit | 842e3ff91428c72a2ce0d4df4889778af82f4b12 (patch) | |
tree | 5a94240e321022019f593f6bd712833ab12138c6 /doc/prefix.n | |
parent | 8b464633a0f2df93912ad25af65a5724cd643da2 (diff) | |
download | tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.zip tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.gz tcl-842e3ff91428c72a2ce0d4df4889778af82f4b12.tar.bz2 |
Improve clarity of formatting.
Diffstat (limited to 'doc/prefix.n')
-rw-r--r-- | doc/prefix.n | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/doc/prefix.n b/doc/prefix.n index f72c4be..6247583 100644 --- a/doc/prefix.n +++ b/doc/prefix.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: prefix.n,v 1.2 2008/10/03 13:24:45 dkf Exp $ +'\" RCS: @(#) $Id: prefix.n,v 1.3 2008/10/17 10:22:25 dkf Exp $ '\" .so man.macros .TH prefix n 8.6 Tcl "Tcl Built-In Commands" @@ -20,18 +20,22 @@ prefix \- Facilities for prefix matching .fi .BE .SH DESCRIPTION +.PP This document describes commands looking up a prefix in a list of strings. The following commands are supported: .TP \fB::tcl::prefix all\fR \fItable\fR \fIstring\fR +. Returns a list of all elements in \fItable\fR that begins with the prefix \fIstring\fR. .TP \fB::tcl::prefix longest\fR \fItable\fR \fIstring\fR +. Returns the longest common prefix among all elements in \fItable\fR that begins with the prefix \fIstring\fR. .TP \fB::tcl::prefix match\fR ?\fIoptions\fR? \fItable\fR \fIstring\fR +. If \fIstring\fR equals one element in \fItable\fR or is a prefix to exactly one element, the matched element is returned. If not, the result depends on the \fB\-error\fR option. @@ -54,6 +58,7 @@ message. The default corresponds to setting Example: If \fB\-error\fR "\-errorcode MyError \-level 1" is used, an error would be generated as: .RS +.PP .CS return \-errorcode MyError \-level 1 \-code error "ErrMsg" .CE @@ -61,6 +66,7 @@ return \-errorcode MyError \-level 1 \-code error "ErrMsg" .SH "EXAMPLES" .PP Basic use: +.PP .CS namespace import ::tcl::prefix \fBprefix match\fR {apa bepa cepa} apa @@ -78,6 +84,7 @@ namespace import ::tcl::prefix .CE .PP Simplifying option matching: +.PP .CS array set opts {\-apa 1 \-bepa "" \-cepa 0} foreach {arg val} $args { @@ -86,6 +93,7 @@ foreach {arg val} $args { .CE .PP Switch supporting prefixes: +.PP .CS switch [prefix match {apa bepa cepa} $arg] { apa { } |