1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-18 02:40:54 +00:00
Beego/vendor/github.com/go-redis/redis/internal/util.go
2018-07-30 12:05:51 +08:00

30 lines
427 B
Go

package internal
import "github.com/go-redis/redis/internal/util"
func ToLower(s string) string {
if isLower(s) {
return s
}
b := make([]byte, len(s))
for i := range b {
c := s[i]
if c >= 'A' && c <= 'Z' {
c += 'a' - 'A'
}
b[i] = c
}
return util.BytesToString(b)
}
func isLower(s string) bool {
for i := 0; i < len(s); i++ {
c := s[i]
if c >= 'A' && c <= 'Z' {
return false
}
}
return true
}