Expand description
Locale-aware list formatting (CLDR / UTS #35): joining items with the right
connectors, e.g. "a, b, and c" (English “and”) or "a, b o c" (Spanish
“or”). Requires the alloc feature.
use intl::list::{format_list, ListStyle};
assert_eq!(format_list("en", &["a", "b", "c"], ListStyle::And), "a, b, and c");
assert_eq!(format_list("en", &["a", "b"], ListStyle::Or), "a or b");
assert_eq!(format_list("de", &["a", "b", "c"], ListStyle::And), "a, b und c");Structs§
- List
Patterns - The four CLDR list connector patterns (each contains
{0}and{1}). - List
Spec - The list patterns for one locale (both styles).
Enums§
- List
Style - Whether a list is conjunctive (“and”) or disjunctive (“or”).
Functions§
- format_
list - Join
itemsinto a single string using the list conventions oflang.