3.2.11. CENTER(string, length [, padchar ] )
     CENTRE(string, length [, padchar ] )

This function has two names, to support both American and British
spelling. It will center string in a string total of length length
characters. If length (which must be a non-negative whole number)
is greater than the length of string, string is padded with
padchar or <space> if padchar is unspecified. If length is smaller
than the length of string character will be removed.

If possible, both ends of string receives (or loses) the same
number of characters. If an odd number of characters are to be
added (or removed), one character more is added to (or removed
from) the right end than the left end of string.

     CENTER(‘Foobar’,10) –>   ‘  Foobar  ‘
     CENTER(‘Foobar’,11) –>   ‘  Foobar   ’
     CENTRE(‘Foobar’,3)  –>   ‘oob’
     CENTER(‘Foobar’,4)  –>   ‘ooba’
     CENTER(‘Foobar’,10,’*’)  –>   ‘**Foobar**’


PREV NEXT