1. Home
  2. TXSPLIT procedure

TXSPLIT procedure

Splits a text into individual texts, at positions on each line marked by separator character(s) (R.W. Payne).

Options

SEPARATOR = text Defines the character(s) that indicate where to split each line; default ','
INCLUDE = string tokens Whether to retain the separator at the end of a split text, or any spaces at its start and end (separators, spaces) ; default * i.e. include neither

Parameters

TEXT = texts Text to split
SPLITTEXTS = texts Saves the texts into which TEXT is split

Description

TXSPLIT splits a text into individual texts. The positions at which to split each line are marked by the character, or characters, specified by the SEPARATOR option; by default, the separator character is a comma.

By default, TXSPLIT removes the separators between the split texts, as well as any spaces at the start and end of each spit text (i.e. any spaces around the separators, or at the start or end of the original text). The INCLUDE option allows you to request that the separator be left at the end of a split text, and that these spaces should be retained.

The TEXT parameter supplies the text that is to be split. The texts into which it is split are saved, in a pointer, by the SPLITTEXTS parameter.

Options: SEPARATOR, INCLUDE.

Parameters: TEXT, SPLITTEXTS.

Action with RESTRICT

Any restrictions on the original text are ignored.

See also

Directives: TXBREAK, TXCONSTRUCT, TXFIND, TXPOSITION, TXREPLACE.

Commands for: Calculations and manipulation.

Example

CAPTION 'TXSPLIT example'; STYLE=meta
TEXT    [VALUES='London, Oxford, Stratford upon Avon, Warwick',\
        'Windsor, Stonehenge, Bath',\
        'Leeds Castle, Dover, Canterbury, Greenwich',\
        'Oxford, Cambridge'] Itineraries
TXSPLIT Itineraries; SPLITTEXTS=Stops
PRINT   Itineraries,Stops[]
Updated on June 17, 2019

Was this article helpful?