I’ve got a math function where I’m converting a base36 number to a
base 10 integer and it works wonderfully, except when the first
character is a zero.
I could get this method to work if I could look at the first position
in a string, and if it was a zero, I’d then add a zero to the first
position of the resulting string.
Here’s the equation (and its compliment);
onum = calc_ovalue(barcode)
(onum + 1).to_s(36).upcase
(onum - 1).to_s(36).upcase
some examples of accepeting the first value and calculating the second
0N5F 0N5G ovalue = 30003
0V9B 0V9C ovalue = 40511
6JYV 6JYW ovalue = 305815