
text2tbl - converts a string into a table

Calling sequence:
text2tbl(string, [ string_1, ...], [ Cyclic ]  )

Parameter:
string     --  character string
string_1   --  character string
Cyclic     --  option

Overloading:

all

Summary:

text2tbl decomposes the character stringstring in substrings and stores
these as character strings in a new table. This table is then returned. The
table contains n entries with the indicies 1..n.

For the decomposition of strings the strings in the list[string_1 ...]
are used as separators.  If the option Cyclic is not given, then string is
decomposed as follows: string is searched for the first appearance of one of
the separators in the list [string_1 ...]. All characters up to this seperator
are stored under the index 1, the seperator under 2.  The same process is

used on the remaining character string, except that the indicies for the first
character string and seperator are now 3 and 4. This process is carried out
until no characters remain in the character string.

If the option Cyclic is given as the last argument of text2tbl then string
is decomposed cyclically. At first, string is searched for the first appearance
of the first separator string string_1. Once again all characters up to the
seperator are stored under the index 1 and the seperator under index 2. Then
the remaining string is search for the first appearance of the next separator.
Again the characters up to the seperator string are stored under index 3 and
the seperator under index 4.  This process is carried out as long as there
are characters in string which are not already stored in the result.  If the
list of seperators is worked through the process is carried out using the first
separator.

With both processes a concatenationof the table entries once more give the
original character string. text2tbl is a kernel function.

>>  text2tbl("Oh,a text,how nice!",["an","how","a"]);

      table(1="Oh,",2="a",3=" text,",4="how",5=" nice!")

>>  text2tbl("Oh,a text,how nice!", [" ",","],Cyclic);

      table(1="Oh,a",2=" ",3="text",4=",",5="how",6=" ",7="nice!")

See also:  tbl2text , text2expr , text2list

