0

I have two columns in my Google Sheets: one column for base 10 and one column for base 36. I have filled out my Base 10 column to go from 1 to 5,000. I would like to create a function in my script that will allow me to take in the value of the Base 10 number and return a value of base 36. (0123456789abcdefghijklmnopqrstuvwxyz) I want to keep the letter lower case so that I won't confuse the number 0 with the letter O.

This is what I have tried so far in my script:

function toBase36(decNumb) {

    var base36 = parseInt(decNumb, 36);

  return parseInt(base36);
}

The code above produces the following result:

enter image description here

How can I edit my code that that I will add the lower case letters?

4

1 回答 1

3

It would be much simpler to use the toString() method.

Instead of var base36 = parseInt(decNumb, 36);

use var base36 = decNumb.toString(36);

于 2015-11-06T07:50:26.790 回答