diff options
Diffstat (limited to 'modules/util/util.go')
-rw-r--r-- | modules/util/util.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/util/util.go b/modules/util/util.go index 90d0eca15c..af6581f7cd 100644 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -170,3 +170,14 @@ func CryptoRandomBytes(length int64) ([]byte, error) { _, err := rand.Read(buf) return buf, err } + +// ToUpperASCII returns s with all ASCII letters mapped to their upper case. +func ToUpperASCII(s string) string { + b := []byte(s) + for i, c := range b { + if 'a' <= c && c <= 'z' { + b[i] -= 'a' - 'A' + } + } + return string(b) +} |