Reason #110 •
April 20th, 2026
ActiveSupport: String#titleize
This one, I think, speaks for itself:
Ruby
"quarterly_revenue_report".titleize
# => "Quarterly Revenue Report"
"x-men: the last stand".titleize
# => "X Men: The Last Stand"
JavaScript
const titleize = (value) =>
value
.replace(/[_-]+/g, " ")
.replace(/\b\w/g, (char) => char.toUpperCase());
titleize("quarterly_revenue_report");
// => "Quarterly Revenue Report"
titleize("x-men: the last stand");
// => "X Men: The Last Stand"
Never did your String get redressed for public consumption so quickly and easily as with titleize 🕺
History
titleize landed in ActiveSupport 0.14.2, released in 2005.
Interestingly, the original commit message called it a "title case" method, and Rails also kept titlecase as an alias.