returns a string of length length with string centered in it, with pad characters added as necessary to make up length. The default pad character is a blank. If string is longer than length, it is truncated at both ends to fit. If an odd number of characters are truncated or added, the right-hand end loses or gains one more character than the left-hand end.>>-DBCENTER--(--string--,--length-------------------------------> >--+---------------------------+--)---------------------------->< '-,--+-----+--+-----------+-' '-pad-' '-,--option-'
The option controls the counting rule. Y counts SO and SI within mixed strings as one each. N does not count the SO and SI and is the default.
DBCENTER('<.A.B.C>',4) -> ' <.B> '
DBCENTER('<.A.B.C>',3) -> ' <.B>'
DBCENTER('<.A.B.C>',10,'x') -> 'xx<.A.B.C>xx'
DBCENTER('<.A.B.C>',10,'x','Y') -> 'x<.A.B.C>x'
DBCENTER('<.A.B.C>',4,'x','Y') -> '<.B>'
DBCENTER('<.A.B.C>',5,'x','Y') -> 'x<.B>'
DBCENTER('<.A.B.C>',8,'<.P>') -> ' <.A.B.C> '
DBCENTER('<.A.B.C>',9,'<.P>') -> ' <.A.B.C.P>'
DBCENTER('<.A.B.C>',10,'<.P>') -> '<.P.A.B.C.P>'
DBCENTER('<.A.B.C>',12,'<.P>','Y') -> '<.P.A.B.C.P>'