Say you have the string \"Hi\"
. How do you get a value of 8
, 9
(\"H\"
is the 8th letter of the alphabet, and \"i\"
Note Cary Swoveland had already given a same answer in a comment to the question.
It is impossible to do that through the numbers 8 and 9 because these numbers do not contain information about the case of the letters. But if you do not insist on converting the string via the number 8 and 9, but instead more meaningful numbers like ASCII code, then you can do it like this:
"Hi".chars.map(&:next).join
# => "Ij"