Created
June 20, 2019 17:42
-
-
Save zhoufenfens/5f7c479f28a6dca9c628a51014878079 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function string10to62(number) { | |
var chars = '0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ'.split(''), | |
radix = chars.length, | |
qutient = +number, | |
arr = []; | |
do { | |
mod = qutient % radix; | |
qutient = (qutient - mod) / radix; | |
arr.unshift(chars[mod]); | |
} while (qutient); | |
return arr.join(''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment