js怎么把数字转化为字母(A,B.....AA,AB,..)
程序员文章站
2023-02-21 07:56:56
function createCellPos( n ){ var ordA = 'A'.charCodeAt(0); var ordZ = 'Z'.charCodeAt(0); var len = ordZ - ordA + 1; var s = ""; while( n >= 0 ) { s = ......
function createcellpos( n ){
var orda = 'a'.charcodeat(0);
var ordz = 'z'.charcodeat(0);
var len = ordz - orda + 1;
var s = "";
while( n >= 0 ) {
s = string.fromcharcode(n % len + orda) + s;
n = math.floor(n / len) - 1;
}
return s;
}
createcellpos(26)//"aa"
原文:https://blog.csdn.net/weixin_42349358/article/details/80517198