summaryrefslogtreecommitdiffstats
path: root/doc/string.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/string.n')
-rw-r--r--doc/string.n32
1 files changed, 28 insertions, 4 deletions
diff --git a/doc/string.n b/doc/string.n
index aefe485..987aeae 100644
--- a/doc/string.n
+++ b/doc/string.n
@@ -18,6 +18,7 @@ string \- Manipulate strings
.PP
Performs one of several string operations, depending on \fIoption\fR.
The legal \fIoption\fRs (which may be abbreviated) are:
+.\" METHOD: cat
.TP
\fBstring cat\fR ?\fIstring1\fR? ?\fIstring2...\fR?
.
@@ -32,6 +33,7 @@ of a concatenation without resorting to \fBreturn\fR \fB\-level 0\fR,
and is more efficient than building a list of arguments and using
\fBjoin\fR with an empty join string.
.RE
+.\" METHOD: compare
.TP
\fBstring compare\fR ?\fB\-nocase\fR? ?\fB\-length\fI length\fR? \fIstring1 string2\fR
.
@@ -42,6 +44,7 @@ than \fIstring2\fR. If \fB\-length\fR is specified, then only the
first \fIlength\fR characters are used in the comparison. If
\fB\-length\fR is negative, it is ignored. If \fB\-nocase\fR is
specified, then the strings are compared in a case-insensitive manner.
+.\" METHOD: equal
.TP
\fBstring equal\fR ?\fB\-nocase\fR? ?\fB\-length\fI length\fR? \fIstring1 string2\fR
.
@@ -51,6 +54,7 @@ identical, or 0 when not. If \fB\-length\fR is specified, then only
the first \fIlength\fR characters are used in the comparison. If
\fB\-length\fR is negative, it is ignored. If \fB\-nocase\fR is
specified, then the strings are compared in a case-insensitive manner.
+.\" METHOD: first
.TP
\fBstring first \fIneedleString haystackString\fR ?\fIstartIndex\fR?
.
@@ -75,6 +79,7 @@ will return \fB10\fR, but
.PP
will return \fB\-1\fR.
.RE
+.\" METHOD: index
.TP
\fBstring index \fIstring charIndex\fR
.
@@ -87,6 +92,7 @@ string. \fIcharIndex\fR may be specified as described in the
If \fIcharIndex\fR is less than 0 or greater than or equal to the
length of the string then this command returns an empty string.
.RE
+.\" METHOD: insert
.TP
\fBstring insert \fIstring index insertString\fR
.VS "TIP 504"
@@ -105,6 +111,7 @@ or after the end of \fIstring\fR (e.g., \fIindex\fR is \fBend\fR),
\fIinsertString\fR is appended to \fIstring\fR.
.RE
.VE "TIP 504"
+.\" METHOD: is
.TP
\fBstring is \fIclass\fR ?\fB\-strict\fR? ?\fB\-failindex \fIvarname\fR? \fIstring\fR
.
@@ -190,6 +197,7 @@ In the case of \fBboolean\fR, \fBtrue\fR and \fBfalse\fR, if the
function will return 0, then the \fIvarname\fR will always be set to
0, due to the varied nature of a valid boolean value.
.RE
+.\" METHOD: last
.TP
\fBstring last \fIneedleString haystackString\fR ?\fIlastIndex\fR?
.
@@ -214,6 +222,7 @@ will return \fB10\fR, but
.PP
will return \fB1\fR.
.RE
+.\" METHOD: length
.TP
\fBstring length \fIstring\fR
.
@@ -222,6 +231,7 @@ Returns a decimal string giving the number of characters in
number of bytes used to store the string. If the value is a
byte array value (such as those returned from reading a binary encoded
channel), then this will return the actual byte length of the value.
+.\" METHOD: map
.TP
\fBstring map\fR ?\fB\-nocase\fR? \fImapping string\fR
.
@@ -253,8 +263,9 @@ reordered like this,
.PP
it will return the string \fB02c322c222c\fR.
.RE
+.\" METHOD: match
.TP
-\fBstring match\fR ?\fB\-nocase\fR? \fIpattern\fR \fIstring\fR
+\fBstring match\fR ?\fB\-nocase\fR? \fIpattern string\fR
.
See if \fIpattern\fR matches \fIstring\fR; return 1 if it does, 0 if
it does not. If \fB\-nocase\fR is specified, then the pattern attempts
@@ -287,6 +298,7 @@ Matches the single character \fIx\fR. This provides a way of avoiding
the special interpretation of the characters \fB*?[]\e\fR in
\fIpattern\fR.
.RE
+.\" METHOD: range
.TP
\fBstring range \fIstring first last\fR
.
@@ -301,12 +313,14 @@ it is treated as if it were zero, and if \fIlast\fR is greater than or
equal to the length of the string then it is treated as if it were
\fBend\fR. If \fIfirst\fR is greater than \fIlast\fR then an empty
string is returned.
+.\" METHOD: repeat
.TP
\fBstring repeat \fIstring count\fR
.
Returns a string consisting of \fIstring\fR concatenated with itself
\fIcount\fR times. If \fIcount\fR is 0, the empty string will be
returned.
+.\" METHOD: replace
.TP
\fBstring replace \fIstring first last\fR ?\fInewstring\fR?
.
@@ -323,11 +337,13 @@ then it is treated as if it were \fBend\fR. The initial string is
returned untouched, if \fIfirst\fR is greater than \fIlast\fR, or if
\fIfirst\fR is equal to or greater than the length of the initial string,
or \fIlast\fR is less than 0.
+.\" METHOD: reverse
.TP
\fBstring reverse \fIstring\fR
.
Returns a string that is the same length as \fIstring\fR but with its
characters in the reverse order.
+.\" METHOD: tolower
.TP
\fBstring tolower \fIstring\fR ?\fIfirst\fR? ?\fIlast\fR?
.
@@ -337,6 +353,7 @@ specified, it refers to the first char index in the string to start
modifying. If \fIlast\fR is specified, it refers to the char index in
the string to stop at (inclusive). \fIfirst\fR and \fIlast\fR may be
specified using the forms described in \fBSTRING INDICES\fR.
+.\" METHOD: totitle
.TP
\fBstring totitle \fIstring\fR ?\fIfirst\fR? ?\fIlast\fR?
.
@@ -348,6 +365,7 @@ refers to the first char index in the string to start modifying. If
\fIlast\fR is specified, it refers to the char index in the string to
stop at (inclusive). \fIfirst\fR and \fIlast\fR may be specified
using the forms described in \fBSTRING INDICES\fR.
+.\" METHOD: toupper
.TP
\fBstring toupper \fIstring\fR ?\fIfirst\fR? ?\fIlast\fR?
.
@@ -357,6 +375,7 @@ specified, it refers to the first char index in the string to start
modifying. If \fIlast\fR is specified, it refers to the char index in
the string to stop at (inclusive). \fIfirst\fR and \fIlast\fR may be
specified using the forms described in \fBSTRING INDICES\fR.
+.\" METHOD: trim
.TP
\fBstring trim \fIstring\fR ?\fIchars\fR?
.
@@ -364,6 +383,7 @@ Returns a value equal to \fIstring\fR except that any leading or
trailing characters present in the string given by \fIchars\fR are removed. If
\fIchars\fR is not specified then white space is removed (any character
for which \fBstring is space\fR returns 1, and "\e0").
+.\" METHOD: trimleft
.TP
\fBstring trimleft \fIstring\fR ?\fIchars\fR?
.
@@ -371,6 +391,7 @@ Returns a value equal to \fIstring\fR except that any leading
characters present in the string given by \fIchars\fR are removed. If
\fIchars\fR is not specified then white space is removed (any character
for which \fBstring is space\fR returns 1, and "\e0").
+.\" METHOD: trimright
.TP
\fBstring trimright \fIstring\fR ?\fIchars\fR?
.
@@ -383,6 +404,7 @@ for which \fBstring is space\fR returns 1, and "\e0").
These subcommands are currently supported, but are likely to go away in a
future release as their functionality is either virtually never used or highly
misleading.
+.\" METHOD: bytelength
.TP
\fBstring bytelength \fIstring\fR
.
@@ -424,6 +446,7 @@ and then apply \fBstring length\fR to that.
.CE
.RE
.TP
+.\" METHOD: wordend
\fBstring wordend \fIstring charIndex\fR
.
Returns the index of the character just after the last one in the word
@@ -432,6 +455,7 @@ may be specified using the forms in \fBSTRING INDICES\fR. 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.
+.\" METHOD: wordstart
.TP
\fBstring wordstart \fIstring charIndex\fR
.
@@ -500,14 +524,14 @@ set length [\fBstring length\fR $string]
if {$length == 0} {
set isPrefix 0
} else {
- set isPrefix [\fBstring equal\fR \-length $length $string "foobar"]
+ set isPrefix [\fBstring equal\fR -length $length $string "foobar"]
}
.CE
.SH "SEE ALSO"
expr(n), list(n)
.SH KEYWORDS
-case conversion, compare, index, integer value, match, pattern, string, word, equal,
-ctype, character, reverse
+case conversion, compare, index, integer value, match, pattern, string,
+word, equal, ctype, character, reverse
.\" Local Variables:
.\" mode: nroff
.\" End: