You are viewing a single comment's thread. Return to all comments →
def tranf(letra) return letra unless letra.match?(/[A-Za-z]/) offset = letra.upcase == letra ? 'A'.ord : 'a'.ord ((letra.ord - offset + 13) % 26 + offset).chr end def rot13(secret_messages) secret_messages.map { |message| message.each_char.map { |c| tranf(c) }.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 →