How to skip over whitespaces in .map. Ruby

后端 未结 0 1701
-上瘾入骨i
-上瘾入骨i 2021-01-29 09:41

This is my code:

def weirdcase (string) string.chars.map.with_index {|letter, index| unless index.odd?; letter = letter.upcase else letter end}.compact.join("")

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