def titleize(string) string.split(\" \").map {|word| word.capitalize}.join(\" \") end
This titleizes every single word, but how do I capture cert
If you want not to capitalize and or the, just do the following:
def titleize(string) nocaps = "and" string.split(" ").map { |word| nocaps.include?(word) ? word : word.capitalize }.join(" ") end