Pads strings of a text structure with extra characters so that their lengths are equal (J.T.N.M. Thissen).
Options
PADDINGCHARACTERS = string token |
Character(s) used for padding; default uses the dot character '.' |
|---|---|
METHOD = string token |
Whether the character(s) of PADDINGCHARACTERS should be placed before or after the strings of OLDTEXT (before, after); default afte |
REMOVESPACES = string tokens |
Whether to remove initial and/or trailing spaces in the strings of OLDTEXT (leading, trailing); default * i.e. none |
Parameters
OLDTEXT = texts |
Texts to be padded; must be set |
|---|---|
NEWTEXT = texts |
Saves the padded texts |
WIDTH = scalars |
Sets a limit on the length of the strings in the padded texts; default is the width of the largest string in OLDTEXT |
Description
Procedure TXPAD can be used to make the strings of a text of equal length by padding them with extra characters. This may be used to make printed output more readable. The text is specified by the OLDTEXT parameter, and the new text can be saved by the NEWTEXT parameter. If NEWTEXT is not specified, the new text values replace those in OLDTEXT. The length can be specified by the WIDTH parameter, which defaults to the number of characters of the largest string.
The character(s) to be added to the strings with smaller length can be specified by the PADDINGCHARACTERS option, with a default of the dot character(.). The METHOD option specifies whether the characters of PADDINGCHARACTERS are placed before or after the strings of OLDTEXT (default after). The REMOVESPACES option specifies whether leading and/or trailing spaces in the strings of OLDTEXT should be removed; the default is to remove no spaces.
Options: PADDINGCHARACTERS, METHOD, REMOVESPACES.
Parameters: OLDTEXT, NEWTEXT, WIDTH.
Action with RESTRICT
If the OLDTEXT structure is restricted, only the restricted units are modified to have equal widths. If the OLDTEXT structure is restricted and a NEWTEXT structure is specified, the units of NEWTEXT not in the restriction set are set to repeated PADDINGCHARACTERS character(s).
See also
Directives: CONCATENATE, TXCONSTRUCT, TXREPLACE.
Procedure: TXPROGRESSION, TXSPLIT.
Commands for: Calculations and manipulation.
Example
CAPTION 'TXPAD example'; STYLE=meta TEXT [VALUES=Amsterdam,London,Paris] old TXPAD old; NEWTEXT=new PRINT old,new; FIELD=14 TXPAD [PADDINGCHARACTERS='<'; METHOD=before] old; NEWTEXT=new; WIDTH=10 PRINT old,new; FIELD=14