Update to the Int’l Code Ice-Breaker Is there a column-type to convert an array of A-Z to an array of 1-26 (position in the alphabet)?
function alphaWord(text) {
// set up the replacement array
let alphaWord = ["Alpha", "Bravo", "Charlie", "Delta", "Echo",
"Foxtrot", "Golf", "Hotel", "India", "Juliet", "Kilo", "Lima",
"Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra",
"Tango", "Uniform", "Victor", "Whiskey", "X-ray", "Yankee", "Zulu"]
let result = '';
// replace graphemes and diacritics. Credit to https://stackoverflow.com/a/37511463/1899661
text = text.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
// convert to uppercase
text = text.toUpperCase();
let unicodeNum;
for (var i = 0; i < text.length; i++){
unicodeNum = text.charCodeAt(i) - 65;
if ((unicodeNum > -1) && (unicodeNum < 26)) {
result += alphaWord[unicodeNum] + " ";
} else {
result += "";
}
}
return result.trim().replace(/ /g, '·')
}
return alphaWord(p1)