1textutil::split(n)Text and string utilities, macro processingtextutil::split(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       textutil::split - Procedures to split texts
9

SYNOPSIS

11       package require Tcl  8.2
12
13       package require textutil::split  ?0.8?
14
15       ::textutil::split::splitn string ?len?
16
17       ::textutil::split::splitx string ?regexp?
18
19______________________________________________________________________________
20

DESCRIPTION

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  re‐
33              turn an empty list. If the length of the string is not an entire
34              multiple of the chunk length, then the last chunk in the  gener‐
35              ated 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: When parentheses are used in the
41              regexp, i.e. regex capture groups, then  these  groups  will  be
42              added into the result list as additional elements. If the string
43              is empty the result is the empty list, like for split.  If  reg‐
44              exp  is empty the string is split at every character, like split
45              does.   The  regular  expression  regexp   defaults   to   "[\\t
46              \\r\\n]+".
47

BUGS, IDEAS, FEEDBACK

49       This  document,  and the package it describes, will undoubtedly contain
50       bugs and other problems.  Please report such in the  category  textutil
51       of  the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist].  Please
52       also report any ideas for enhancements you may have for either  package
53       and/or documentation.
54
55       When proposing code changes, please provide unified diffs, i.e the out‐
56       put of diff -u.
57
58       Note further that  attachments  are  strongly  preferred  over  inlined
59       patches.  Attachments  can  be  made  by  going to the Edit form of the
60       ticket immediately after its creation, and  then  using  the  left-most
61       button in the secondary navigation bar.
62

SEE ALSO

64       regexp(n), split(n), string(n)
65

KEYWORDS

67       regular expression, split, string
68

CATEGORY

70       Text processing
71
72
73
74tcllib                                0.8                   textutil::split(n)
Impressum