字串轉大寫

// 'aS344cv'
String.fromCharCode(65) // A
'Aa'.toChartAt(0) // 65
let result = ''

for(i from 0 to n-1)
    let current = str[i].charCodeAt()
    if(current > 96 && current < 123), do result += String.fromCharCode(current - 32)
    else, do result += str[i]
    

Last updated

Was this helpful?