Conversion Between the 10th and 62th in javascript, javascript62
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('');}function string62to10(number_code) { var chars = '0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ', radix = chars.length, number_code = String(number_code), len = number_code.length, i = 0, origin_number = 0; while (i < len) { origin_number += Math.pow(radix, i++) * chars.indexOf(number_code.charAt(len - i) || 0); } return origin_number;}
Convert decimal number 62 to binary number Yes
(62) 10
= (0*1010 + 110) * 1010 + 10) 2
= (110*1010 + 10) 2
= (111100 + 10) 2
= (0, 111110) 2
Javascript 10-to-16-to-zero
Because js does not have a method similar to '0' * x, and there is no function similar to using a character string that is less than the specified length, you can only write
Function str_pad (hex ){
Var zero = '20140901 ';
Var tmp = 8-hex.length;
Return zero. substr (0, tmp) + hex;
}