RUBY | Find a way to find an exception on the same word to capitalize

前端 未结 0 1484
执笔经年
执笔经年 2021-01-19 04:57
def titleize(string)

nocaps = ["the","and"]
puts string.split(" ").map { |word| nocaps.include?(word) ? word : word.capitalize }.join(         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题