1. Home
  2. FSTRING procedure

FSTRING procedure

Forms a single string from a list of strings in a text (R.W. Payne).

No options

Parameters

TEXT = texts Texts containing the lists of strings to put into single strings
STRING = texts Text to store the strings in each TEXT
SEPARATOR = texts Characters to separate all except last two strings of each TEXT; default ', '
LASTSEPARATOR = texts Characters to separate last two strings of each TEXT; default SEPARATOR
PREFIX = texts Characters to insert at the start of each STRING; default '' (i.e. none)
END = texts Characters to put at the end of each STRING; default '' (i.e. none)

Description

This procedure forms a string from a list of strings. The strings are input in a text specified by the TEXT parameter, and the string is saved using the STRING parameter. The SEPARATOR parameter allows you to specify the characters to separate the strings. The default is to use the characters ', '. The LASTSEPARATOR parameter allows you to supply a different set of characters to separate the last pair of strings. The PREFIX parameter can supply characters to put at the start of the STRING, and the END parameter can supply characters to put at the end.

Options: none.

Parameters: TEXT, STRING, SEPARATOR, LASTSEPARATOR, PREFIX, END.

Method

The output STRING is formed from the input TEXT using CONCATENATE.

Action with RESTRICT

If the TEXT is restricted, the STRING will be formed only with the units not excluded by the restriction.

See also

Directive: TXCONSTRUCT.

Commands for: Calculations and manipulation.

Example

CAPTION 'FSTRING example'; STYLE=meta
TEXT    t1,t2,t3; VALUES=!t(a),!t(a,b),!t(a,b,c)
FSTRING t1,t2,t3; STRING=s1,s2,s3; SEPARATOR=', ';\
        LASTSEPARATOR=' or '; END='.'
PRINT   s1,s2,s3
FSTRING t1,t2,t3; STRING=s1,s2,s3; SEPARATOR=','
PRINT   s1,s2,s3
Updated on June 19, 2019

Was this article helpful?