Sathish Manohar Sathish Manohar - 1 year ago 92
Ruby Question

How to align ruby string to left or right?

I have few ruby strings, which I want to align left and right appropriately.

I'm now using

"Name".center(20, " ")
to get
"(7 spaces)Name(8 spaces)"

How can I achieve
"Name(15 spaces)"
"(15 spaces)Name"


Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download