比如:'AZaz' => '0 25 26 51'
我目前的做法:
function Words(words){
let strArray = []
for (let s of words){
if(/[A-Z]/.test(s)) strArray.push(s.charCodeAt(0)-65)
else if(/[a-z]/.test(s)) strArray.push(s.charCodeAt(0)-71)
}
return(strArray.join(' '))
}
Words('AZaz')