mirror of
https://github.com/spf13/viper
synced 2024-11-20 11:57:02 +00:00
28 lines
318 B
Go
28 lines
318 B
Go
package insensitiveopt
|
|
|
|
import (
|
|
"strings"
|
|
"unicode"
|
|
)
|
|
|
|
var insensitive = true
|
|
|
|
func Insensitive(f bool) {
|
|
insensitive = f
|
|
}
|
|
|
|
func ToLower(s string) string {
|
|
if insensitive {
|
|
return strings.ToLower(s)
|
|
}
|
|
|
|
return s
|
|
}
|
|
|
|
func ToLowerRune(s rune) rune {
|
|
if insensitive {
|
|
return unicode.ToLower(s)
|
|
}
|
|
|
|
return s
|
|
}
|