Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
Compare is `a.localeCompare(b)` under the root locale: punctuation and case are weighed as Node weighs them, `a` before `A`, accents after base letters, U+FFFD last. The collation tables are golang.org/x/text's (collate.CLDRVersion, collate.UnicodeVersion), older than Node's ICU. It is safe for concurrent use and returns -1, 0 or 1.
Types ¶
type Collator ¶
type Collator struct {
// contains filtered or unexported fields
}
Collator compares strings as `a.localeCompare(b)` does under the root locale (see Compare). Like the collate.Collator it wraps it keeps scratch buffers, so one Collator must not be shared by goroutines.
func NewCollator ¶
func NewCollator() *Collator
NewCollator returns a Collator that orders strings as Node's root-locale localeCompare does.
func (*Collator) CompareString ¶
CompareString returns -1, 0 or 1.