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