tree: 7c7d237d5018006f72587ae115eea6be5701e4f4
  1. src/
  2. tests/
  3. Cargo.toml
  4. LICENSE
  5. README.md
components/pattern/README.md

icu_pattern crates.io

icu_pattern is a utility crate of the ICU4X project.

It includes a [Pattern] type which supports patterns with various storage backends.

The types are tightly coupled with the [writeable] crate.

Examples

Parsing and interpolating with a single-placeholder pattern:

use icu_pattern::SinglePlaceholderPattern;
use writeable::assert_writeable_eq;

// Parse a pattern string:
let pattern = SinglePlaceholderPattern::try_from_str(
    "Hello, {0}!",
    Default::default(),
)
.unwrap();

// Interpolate into the pattern string:
assert_writeable_eq!(pattern.interpolate(["World"]), "Hello, World!");

More Information

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