javascript convert number to spreadsheet column
// converts numbers to spreadsheet letter columns eg. 1 -> A
function numToSSColumn(num){
let s = '', t;
while (num > 0) {
t = (num - 1) % 26;
s = String.fromCharCode(65 + t) + s;
num = (num - t)/26 | 0;
}
return s || undefined;
}
numToSSColumn(0); // undefined
numToSSColumn(1); // A
numToSSColumn(26); // Z
numToSSColumn(-1); // undefined
numToSSColumn(27); // AA
numToSSColumn(475254); // ZZZZ
Also in JavaScript:
- angular formData print values
- beautiful day at the movies hackerrank solution
- jQuery create div element
- check a checkbox jquery
- js generate list of names with forloop
- how to get user ip address in javascript
- bash expression
- set localstorage
- javascript change background color
- javascript object array sum of values in object
- swiftyjson
- node red reverse proxy for ui to root
- angular cli spec test false
- react dom
- update nodejs
- how to write and read a text file in jdiscord.js
- loop through api response in react
- jquery vdn
- instanr pagination ajax weblesson
- react native add custom fonts
- render image url in react native
- js ask before close chrome
- js detect right key click
- angular this web site use cookie example