Class ListFormat

java.lang.Object
org.jboss.elemento.intl.ListFormat

@JsType(isNative=true, namespace="<global>", name="Intl.ListFormat") public class ListFormat extends Object
Mapping for Intl.ListFormat.

var vehicles = JsArray.of("Motorcycle", "Bus", "Car");

var formatter = new ListFormat("en", ListFormatOptions.create()
        .style(long_)
        .type(conjunction));
console.log(formatter.format(vehicles));
// Expected output: "Motorcycle, Bus, and Car"

var formatter2 = new ListFormat("de", ListFormatOptions.create()
        .style(short_)
        .type(disjunction));
console.log(formatter2.format(vehicles));
// Expected output: "Motorcycle, Bus oder Car"

var formatter3 = new ListFormat("en", ListFormatOptions.create()
        .style(narrow)
        .type(unit));
console.log(formatter3.format(vehicles));
// Expected output: "Motorcycle Bus Car"
See Also: