You are viewing a single comment's thread. Return to all comments →
def rot13(secret_messages) secret_messages.map { |v| rott(v)} end def rott(msg) vv = msg.split('') upper = *'A'..'Z' lower = *'a'..'z' vv.map do |sen| u = upper.index(sen) l = lower.index(sen) unless u i = u || l next sen unless i i = i+13 > 26 ? i-39 : i+13 l ? lower[i] : upper[i] end.join end
Seems like cookies are disabled on this browser, please enable them to open this website
Ruby - Enumerable - collect
You are viewing a single comment's thread. Return to all comments →