16 lines
385 B
Go
16 lines
385 B
Go
package comparators
|
|
|
|
import (
|
|
"golang.org/x/text/collate"
|
|
"golang.org/x/text/language"
|
|
"pkg.icikowski.pl/collections/functions"
|
|
)
|
|
|
|
// CompareString returns [functions.Comparator] for string values in given language.
|
|
func CompareString(lang language.Tag) functions.Comparator[string] {
|
|
c := collate.New(lang)
|
|
return func(a, b string) bool {
|
|
return c.CompareString(a, b) < 0
|
|
}
|
|
}
|