zenspider.com
(For all intents and purposes, this project is dead, but let us just call it "Deferred Indefinitely". Shall we?)

Problem

You need to modify the case of a string, up, down, or capitolized.

Solution

! s = “this Is A weird Sentence” ! s.upcase # uppercase ! s.downcase # lowercase ! s.capitalize # capitalize first word, downcase rest ! s.swapcase # reverse the case of each alpha character ! # don’t forget all of the bang equivalents (eg upcase!)

Discussion

The string class has a full complement of modification methods including upcase, downcase, capitalize, and swapcase. Each one of those also has a “bang version” (a ruby method-naming idiom where it modifies the object in place rather than returning a modified copy).

Contrast

Status: In Progress