字符转ASCII码:str='a'; str.charCodeAt()
ASCII码转字符:String.fromCharCode(num)
// 将字符串中的大写转为小写
function toLowerCase(s: string): string {
let res = "";
for (let i = 0; i < s.length; i++) {
let c = s.charCodeAt(i);
if (c >= 65 && c <= 90) {
res += String.fromCharCode(c + 32);
} else {
res += s[i];
}
}
return res;
}
toLowerCase("azAZ"); //"azaz"