string wordend

Gives the index after the last character of the word at an index.

string wordend STRING INDEX

Description

Gives the index just after the last character of the word that has the character at INDEX. Words follow the rules of string wordstart.

An INDEX below 0 or past the end gives the length of STRING, and an empty STRING gives 0.

Arguments

ArgumentTypeDefaultDescription
STRINGstringrequiredThe text.
INDEXindexrequiredThe index of a character in the word.

Returns

An index.

Examples

% string wordend "hello world" 1
5

% string wordend "hello world" 5
6

% string wordend a.b 1
2

% string wordend abc 10
3

Errors

% string wordend a
wrong # args: should be "string wordend string index"
-errorcode TCL WRONGARGS

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also