method
center
center(...)
public
Register or
log in
to add new notes.
WedTM -
February 11, 2010 - (v1_8_7_72)
0 thanks
Odd Number of padding characters
In the case of an odd number of empty spaces in a length, Ruby will append the extra character to the right-hand side of the string.
Example:
irb(main):002:0> "Hello".center(10,"-") => "--Hello---"