Javascript Number base26()

Description

Javascript Number base26()

Number.prototype.base26 = (function () {
 return function base26() {
  n = this/*  w ww  .j  a  v  a 2s.  co  m*/
  ret = "";
  while(parseInt(n)>0){
   --n;
   ret += String.fromCharCode("A".charCodeAt(0)+(n%26));
   n/=26;
  }
  return ret.split("").reverse().join("");
 };
}());



PreviousNext

Related