summaryrefslogtreecommitdiffstats
path: root/doc/string.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-05-27 18:50:09 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-05-27 18:50:09 (GMT)
commitf0159bec481b8b56d7b70ae333acc455e5d6c3d3 (patch)
treec6e92fdef9da0a7c92d244f8408eaf9d289e0c59 /doc/string.n
parentea76d39f0ce53ab67f3af2edef1f5bb629a5afe6 (diff)
downloadtcl-f0159bec481b8b56d7b70ae333acc455e5d6c3d3.zip
tcl-f0159bec481b8b56d7b70ae333acc455e5d6c3d3.tar.gz
tcl-f0159bec481b8b56d7b70ae333acc455e5d6c3d3.tar.bz2
Added example.
Diffstat (limited to 'doc/string.n')
-rw-r--r--doc/string.n13
1 files changed, 12 insertions, 1 deletions
diff --git a/doc/string.n b/doc/string.n
index c5e09f1..bc7e210 100644
--- a/doc/string.n
+++ b/doc/string.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: string.n,v 1.18 2003/04/11 20:50:47 dgp Exp $
+'\" RCS: @(#) $Id: string.n,v 1.19 2004/05/27 18:50:09 dkf Exp $
'\"
.so man.macros
.TH string n 8.1 Tcl "Tcl Built-In Commands"
@@ -303,6 +303,17 @@ specified as for the \fBindex\fR method. A word is considered to be any
contiguous range of alphanumeric (Unicode letters or decimal digits)
or underscore (Unicode connector punctuation) characters, or any
single character other than these.
+.SH EXAMPLE
+Test if the string in the variable \fIstring\fR is a proper non-empty
+prefix of the string \fBfoobar\fR.
+.CS
+set length [string length $string]
+if {$length == 0} {
+ set isPrefix 0
+} else {
+ set isPrefix [string equal -length $string $string "foobar"]
+}
+.CE
.SH "SEE ALSO"
expr(n), list(n)