数字与字母相互转换
数字序号转字符串序号 0 => "A"
export function indexToString(index) {
var charcode;
return index.toString(26).split("").map(function (item, i) {
charcode = item.charCodeAt(0);
charcode += (charcode >= 97 ? 10 : 49);
return String.fromCharCode(charcode)
}).join("").toUpperCase();
}
字符串序号转数字序号 "A" => 0
export function stringToIndex(str) {
var charcode;
return parseInt(str.toLowerCase().split("").map(function (item, i) {
charcode = item.charCodeAt(0);
charcode -= (charcode < 107 ? 49 : 10);
return String.fromCharCode(charcode)
}).join(""), 26);
}

浙公网安备 33010602011771号