[Overview][Resource strings][Constants][Types][Procedures and functions][Index] | Reference for unit 'strutils' (#rtl)

# PadCenter

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

## Declaration

Source position: strutils.pp line 159

`function PadCenter(`
`const S: string;`
`Len: Integer`
`):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 largert than Len, no spaces are added, and the string S is returned as-is.

## Errors

None.

## See also

PadLeft |  | Add spaces to the left of a string till a certain length is reached.
PadRight |  | Add spaces to the right of a string till a certain length is reached.
AddChar |  | Add characters to the left of a string till a certain length
AddCharR |  | Add chars at the end of a string till it reaches a certain length

Documentation generated on: Feb 26 2014