10进制数字转为26进制的字母
2017-07-10 本文已影响0人
夫子有多高酱
1 -> 26 -> 27 = A -> Z -> AA
function convert(num){
return num <= 26 ?
String.fromCharCode(num + 64) : convert(~~((num - 1) / 26)) + convert(num % 26 || 26);
}
1 -> 26 -> 27 = A -> Z -> AA
function convert(num){
return num <= 26 ?
String.fromCharCode(num + 64) : convert(~~((num - 1) / 26)) + convert(num % 26 || 26);
}