CENTER (return centered string)

Top  Previous  Next

 

CENTER(string [,length])

CENTER

Returns centered string.

string

A string constant, variable or expression.

length

The length of the return string. If omitted, the length of the string parameter is used.

The CENTER procedure first removes leading and trailing spaces from a string, then pads it with leading and trailing spaces to center it within the length, and returns a centered string.

Return Data Type:

STRING

Example:

 !CENTER('ABC',5) returns ' ABC '

 !CENTER('ABC ')  returns ' ABC '

 !CENTER(' ABC')  returns ' ABC '

 

 Message = CENTER(Message)    !Center the message

 Rpt:Title = CENTER(Name,60)  !Center the name

 

See Also:

LEFT

RIGHT