Originally posted by Samith Nambiar:
parseInt("Kona", 27) returns 411787
Treat this similar to Index 16 - instead use 27.
(K * 27 ^ 3) + (O * 27 ^ 2) + (N * 27 ^ 1) + (A * 27 ^ 0)
For Base-16, we have 0 to 9 and A,B,C,D,E,F for numbers from 10 to 15.
Similarly for Base-27, You'd have numbers from 0 to 9 and then alphabets starting from 'A' representing the numbers from 10 to 26. Alphabet 'R' would represent numeric 26. Therefore you cannot call parseInt() on any string that contains alphabets beyond 'R' using the radix as 27.
For ex: if you change the call as follows:
pasreInt("Sona", 27) --> This should throw an exception.