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\"
\"Hi\"
8
9
\"H\"
\"i\"
You can also create an enumerable of character ordinals from a string using the codepoints method.
codepoints
string = "Hi" string.codepoints.map{|i| (i + 1).chr}.join => "Ij"