Skip to main content

center

Center the value in a field of a given width.

def center(
value: string,
arg: integer
) - > string

Center the value in a field of a given width.

Parameters

NameTypeDescription
valuestringThe string content to be centered within the output field.
argintegerThe total width of the resulting field; if this value is greater than the length of the input, padding is added.

Returns

TypeDescription
stringThe original string padded with spaces on both sides to reach the specified width, or the original string if the width is less than or equal to zero.