Next: , Previous: , Up: Formatted Input/Output   [Contents][Index]


4.3.5 Format Grouping

Parts of a format string can be separated from the rest through format grouping. The beginning of a format group is indicated by %( and the end by a matching %). Format grouping may be nested. A format group end may be followed by a positive integer repeat count and a pound sign #.

Some examples:

LUX>fprint,'%(alf)2#a\n'
alfalfa
LUX>fprint,'%($%.2f %)3#combined\n',2.34,4.32,6.75
$2.34 $4.32 $6.75 combined
LUX>fprint,'x:%=d-; y:%3d\n',[1,2,3],[32,11,2]
x:1-; y:2-; y:3 32 11  2
LUX>fprint,'x:%(%=d-); y:%3d\n',[1,2,3],[32,11,2]
x:1-2-3; y: 32 11  2

See also: Formatted Input/Output