beetlebug▾
/

ztcl::text sentences

Gives the list of the sentences of a string.

ztcl::text sentences STRING

Description

Gives the sentences of UAX #29. Each sentence keeps its closing marks, its spaces, and its line end, so join of the list gives STRING again. A period in a number, such as 3.5, ends no sentence.

Arguments

ArgumentTypeDefaultDescription
STRINGstringrequiredThe string to cut.

Returns

A list of strings.

Examples

Each example of this page runs after package require ztcl::text.

% ztcl::text sentences "It is 3.5 m long. Is it? Yes."
{It is 3.5 m long. } {Is it? } Yes.

% ztcl::text sentences "a\nb"
{a
} b

% ztcl::text sentences ""

Errors

% ztcl::text sentences
wrong # args: should be "ztcl::text sentences string"
-errorcode TCL WRONGARGS

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1
Compute cost
One compute unit for each 4,096 bytes of the string.

See also