js怎么把数字转化为字母(A,B.....AA,AB,..)

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

上一篇:给VMware的虚拟机设置静态地址


下一篇:Mysql分布式部署高可用集群方案