luoheng
10/6/2019 - 7:37 AM

toLowerCase

func toLowerCase(str string) string {
    length := len(str)
    s := make([]byte, length)
    for i := 0; i < length; i++ {
        c := str[i]
        if c <= 'Z' && c >= 'A' {
            c = c - 'A' + 'a'
        }
        s[i] = c
    }
    return string(s)
}