This commit is contained in:
+6
-2
@@ -10,9 +10,13 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"golang.org/x/text/unicode/norm"
|
||||
)
|
||||
|
||||
func UnicodeLowercase(s string) string {
|
||||
// UnicodeLowercaseNormalized returns the Unicode lower case variant of s,
|
||||
// having also normalized it to normalization form C.
|
||||
func UnicodeLowercaseNormalized(s string) string {
|
||||
i := firstCaseChange(s)
|
||||
if i == -1 {
|
||||
return s
|
||||
@@ -28,7 +32,7 @@ func UnicodeLowercase(s string) string {
|
||||
for _, r := range s[i:] {
|
||||
rs.WriteRune(unicode.ToLower(unicode.ToUpper(r)))
|
||||
}
|
||||
return rs.String()
|
||||
return norm.NFC.String(rs.String())
|
||||
}
|
||||
|
||||
// Byte index of the first rune r s.t. lower(upper(r)) != r.
|
||||
|
||||
Reference in New Issue
Block a user