Method: String#center

Defined in:
string.c

#center(integer, padstr) ⇒ String

If integer is greater than the length of str, returns a new String of length integer with str centered and padded with padstr; otherwise, returns str.

"hello".center(4)         #=> "hello"
"hello".center(20)        #=> "       hello        "
"hello".center(20, '123') #=> "1231231hello12312312"

Returns:



4609
4610
4611
# File 'string.c', line 4609

static VALUE
rb_str_center(argc, argv, str)
int argc;