Bluethousandand2 Bluethousandand2 - 7 months ago 63
Ruby Question

Assign number to alphabet in array

What I want to do is use an

to turn each letter into its corresponding letter in the alphabet plus nine. I know it's possible to put it against a
going through all 26 letters, but that seems unnecessary.

For example. Say the array is:

["N", "O", "T", "H", "I", "N", "G"]

I want the array to become

["23", "24", "29", "17", "19", "24", "17"]


Here's one way: {|ch| ch.ord - 'A'.ord + 10}