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);

def calc_ovalue(barcode)

barcode.to_i(36)

end

def calc_other(barcode)

onum = calc_ovalue(barcode)

if onum.odd?

(onum + 1).to_s(36).upcase

else

(onum - 1).to_s(36).upcase

end

end

some examples of accepeting the first value and calculating the second

two are;

0N5F 0N5G ovalue = 30003

0V9B 0V9C ovalue = 40511

6JYV 6JYW ovalue = 305815

Thank you,

Kathleen