Skip to content

Center

See Also: String Functions, Length, Pad, Trim

Purpose

The Center function returns a string of a specified length with spaces added to, or characters truncated from both sides, so that the input content is centered.

Return Type

String

Syntax

(Center({string-value}, {length}))

What It Does

The Center function returns a value that has spaces added to the beginning and end of {string-value} until the length of the expression value is equal to {length}.

Move (Center("DataFlex", 50)) to sChapterName

Notes

  • If {length} is less than the length of {string}, the Center function returns the value of {string} truncated on the right (after first trimming spaces on the left) to {length}.

Example

(Center("--12345678901234567890123456789", 14))

results in:

--123456789012
  • If the parameter {string} is of a type other than string, its value will be converted to a string for output.