The CENTER function pads both ends of a source string with a specified character until the resulting string is a specified length. If the padding is uneven, the function adds an extra character to the end of the string.
The CENTER function has the following format:
CENTER(source, length[, padding])
The CENTER function accepts the following parameters:
source (string or number)
Specifies the source string. The function automatically converts a number to a string.
length (number)
Specifies the length of the resulting string.
padding (string)
(Optional) Specifies the character that the function uses to pad the source string.
The CENTER function returns a string.
Return_value=CENTER('Robin', 9, '*')
Return_value='**Robin**'
Return_value=CENTER('Robin', 7, 'ooo')
Return_value='oRobino'
Return_value=CENTER('Robin', 7, '')
Return_value='Robin'
Return_value=CENTER('Robin', 11)
Return_value=' Robin'
Return_value=CENTER(123, 9)
Return_value='000123000'
Copyright © 2010 CA. All rights reserved. | Email CA about this topic |