Center a string by filling : Justify Center « String « Ruby






Center a string by filling


title = "Love's Labours Lost"

title.center 23, "-" # => "--Love's Labours Lost--"

 








Related examples in the same category

1.Center a string
2.play both ends to the middle
3.use center to create a comment:
4.one space longer than the word