Ruby capitalize every word first letter

ruby, string

Solution

try this:

puts 'one TWO three foUR'.split.map(&:capitalize).join(' ')

#=> One Two Three Four

or

puts 'one TWO three foUR'.split.map(&:capitalize)*' '

Problem

I need to make the first character of every word uppercase, and make the rest lowercase... ``` manufacturer.MFA_BRAND.first.upcase ``` is only setting the first letter uppercase, but I need this: ``` ALFA ROMEO => Alfa Romeo AUDI => Audi BMW => Bmw ONETWO THREE FOUR => Onetwo Three Four ```

Original source

Related problems