Center a string : Justify Center « String « Ruby






Center a string


title = "Love's Labours Lost"

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

 








Related examples in the same category

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