当前位置: 移动技术网 > IT编程>开发语言>JavaScript > js怎么把数字转化为字母(A,B.....AA,AB,..)

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

2019年02月20日  | 移动技术网IT编程  | 我要评论

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 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网