切换字母大小写
- 如2539rgTm53ILO 转换成 2539RGtM53ilo
function switchLetterCase(s:string): string{
let res = ''
const length = s.length
if(length === 0) return res
for(let i = 0; i < length; i++){
const c = s[i]
const code = c.charCodeAt(0) //获取对应ascll编码
if(code >= 65 && code <= 90){.
res += c.toLowerCase() //大写转小写
}else if(code >= 97 && code <= 122){
res += c.toUpperCase()
}else{
res +=c
}
}
return res
}