I\'m trying to convert an all-uppercase string in Ruby into a lower case one, but with each word\'s first character being upper case. Example:
convert \"MY STRING HE
Capitalizes every word in a sentence using ruby, without regex.. because unfortunately those scare me
class Book
attr_accessor :title
def title=(new_title)
result = []
words = new_title.split(' ')
words.each do |word|
capitalized = word[0].upcase + word[1..word.length].downcase
result.push(capitalized)
end
@title = result.join(' ')
end
end