1textutil::split(n)Text and string utilities, macro processingtextutil::split(n)
2
3
4
5______________________________________________________________________________
6
8 textutil::split - Procedures to split texts
9
11 package require Tcl 8.2
12
13 package require textutil::split ?0.7?
14
15 ::textutil::split::splitn string ?len?
16
17 ::textutil::split::splitx string ?regexp?
18
19_________________________________________________________________
20
22 The package textutil::split provides commands that split strings by
23 size and arbitrary regular expressions.
24
25 The complete set of procedures is described below.
26
27 ::textutil::split::splitn string ?len?
28 This command splits the given string into chunks of len charac‐
29 ters and returns a list containing these chunks. The argument
30 len defaults to 1 if none is specified. A negative length is not
31 allowed and will cause the command to throw an error. Providing
32 an empty string as input is allowed, the command will then
33 return an empty list. If the length of the string is not an
34 entire multiple of the chunk length, then the last chunk in the
35 generated list will be shorter than len.
36
37 ::textutil::split::splitx string ?regexp?
38 This command splits the string and return a list. The string is
39 split according to the regular expression regexp instead of a
40 simple list of chars. Note that if you parentheses are added
41 into the regexp, the parentheses part of separator will be added
42 into the result list as additional element. If the string is
43 empty the result is the empty list, like for split. If regexp is
44 empty the string is split at every character, like split does.
45 The regular expression regexp defaults to "[\\t \\r\\n]+".
46
48 This document, and the package it describes, will undoubtedly contain
49 bugs and other problems. Please report such in the category textutil
50 of the Tcllib SF Trackers [http://source‐
51 forge.net/tracker/?group_id=12883]. Please also report any ideas for
52 enhancements you may have for either package and/or documentation.
53
55 regexp(n), split(n), string(n)
56
58 regular expression, split, string
59
60
61
62textutil 0.7 textutil::split(n)