icu_list crates.io

icu_list provides the [ListFormatter] which renders sequences of Writeables as lists in a locale-sensitive way.

Examples

Format a list of strings in Spanish

```rust use iculist::{ListFormatter, ListStyle}; use iculocid::locale; use writeable::Writeable;

let listformatter = ListFormatter::trynewand( locale!("es"), &icutestdata::get_provider(), ListStyle::Wide, ) .expect("Data should load successfully");

asserteq!( listformatter.format(["España", "Suiza"].iter()) .writetostring(), "España y Suiza" );

// The Spanish 'y' sometimes becomes an 'e': asserteq!( listformatter.format(["España", "Suiza", "Italia"].iter()) .writetostring(), "España, Suiza e Italia" );

// We can use any Writeables as inputs: asserteq!( listformatter.format(1..=10).writetostring(), "1, 2, 3, 4, 5, 6, 7, 8, 9 y 10" ); ```

More Information

For more information on development, authorship, contributing etc. please visit ICU4X home page.