The Collator object is a constructor for collators, objects that enable language sensitive string comparison.

Documentation Collator by Mozilla Contributors, licensed under CC-BY-SA 2.5.

Static methods

staticsupportedLocalesOf(locales:String, ?options:CollatorSupportedLocalesOfOptions):Array<String>

staticsupportedLocalesOf(locales:Array<String>, ?options:CollatorSupportedLocalesOfOptions):Array<String>

Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale.

Parameters:

locales

A string with a BCP 47 language tag, or an array of such strings.

Constructor

new(?locales:String, ?options:CollatorOptions)

new(?locales:Array<String>, ?options:CollatorOptions)

Methods

compare(string1:String, string2:String):Int

Getter function that compares two strings according to the sort order of this Collator object.

resolvedOptions():CollatorResolvedOptions

Returns a new object with properties reflecting the locale and collation options computed during initialization of the object.