Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
Menu
Center a string : Justify Center « String « Ruby
Ruby
String
Justify Center
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