Re: multi dim array?

From: Gijs N.

def translate_to_braille(msg)

I think you want the String#tr method. It replaces each character in a
source string with its corresponding character in a replacment string:

normal_alphabet = “abcdefghijklmnopqrstuvwxyz”
rot13_alphabet = “nopqrstuvwxyzabcdefghijklm”

msg = “hello world!”
puts msg.tr( normal_alphabet, rot13_alphabet)
#=> uryyb jbeyq!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs