Saturday, May 16, 2009

Lower Case, Upper Case and Capitalize in Ruby

Ruby has some very straightforward methods to change the case of your strings.

Here are some of them:

"HoMer".downcase # returns homer
"lisa".upcase # returns LISA
"margie".capitalize # returns Margie
"BaRt".swapcase #returns bArT

Just a quick one! :)

Find this article also on definenull.com.

No comments: