Center String

Center a string within a given width by padding with spaces.

Code

General
s.center(width)

Parameters

String to center

Total width

Server

More Ruby Snippets