Method: U::String#center

Defined in:
ext/u/rb_u_string_justify.c

#center(width, padding = ' ') ⇒ U::String

Returns The receiver padded as evenly as possible on both sides with PADDING to make it max(#length, WIDTH) wide, inheriting any taint and untrust from the receiver and also from PADDING if PADDING is used.

Parameters:

Returns:

  • (U::String)

    The receiver padded as evenly as possible on both sides with PADDING to make it max(#length, WIDTH) wide, inheriting any taint and untrust from the receiver and also from PADDING if PADDING is used

Raises:

  • (ArgumentError)

    If PADDING#width = 0

  • (ArgumentError)

    If characters inside PADDING that should be used for round-off padding are too wide

See Also:



131
132
133
134
135
# File 'ext/u/rb_u_string_justify.c', line 131

VALUE
rb_u_string_center(int argc, VALUE *argv, VALUE self)
{
        return rb_u_string_justify(argc, argv, self, 'c');
}