/**
* 获取几个字之后换行的数据
*/
function test(str, num) {
let value = ''
let strNum = 0
let substrCount = Math.ceil(str.length / num)
while (strNum < substrCount) {
let strSubstr = str.substr(strNum * num, num)
console.log(strNum, strSubstr)
strNum += 1
}
return substrCount
}
// console.log(test('北京市第一人民医院', 4))
/**
* 获取excle表格列号 length数据的长度
*/
function getSheetColumn(length) {
let arr = ['A','B','C','D','E','F','G',
'H','I','J','K','L','M','N','O','P','Q',
'R','S','T','U','V','W','.X','Y','Z']
let bei = Math.ceil(length/arr.length)
let returnArr = []
for(let n = 1;n<=length;n++){
let secendNum = n%arr.length==0?26: n%arr.length
let i = Math.ceil( n/arr.length)
if(i==1){
returnArr.push(arr[secendNum-1])
}else{
let secendNum = n%arr.length==0?26: n%arr.length
returnArr.push(arr[i-2]+arr[secendNum-1])
}
}
return returnArr
}
console.log(getSheetColumn(19))
console