思路
根据字母对应的位置关系计算
code
func toLowerCase(str string) string {
s := []byte(str)
for i := 0; i < len(s); i++ {
if s[i] >= 'A' && s[i] <= 'Z' {
s[i] += 'a' - 'A'
}
}
return string(s)
}
更多内容请移步我的repo:https://github.com/anakin/golang-leetcode