Sign in Join
FPDoc Onlineexperiment

PadCenter function

In unit StrUtils

Pad the string to a certain length, so the string is centered.

Declaration

pascal
function PadCenter(const S: string; Len: SizeInt): string

Arguments

S

String to center.

Len

Desired length of the resulting string.

Function result

Centered string of the specified length.

Description

PadCenter add spaces to the left and right of the string S till the result reaches length Len. If the number of spaces to add is odd, then the extra space will be added at the end. If the string S has length equal to or larger than Len, no spaces are added, and the string S is returned as-is.

Errors

None.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.