Skip to main content

scrub_with

Function scrub_with 

Source
pub fn scrub_with(text: &str, cfg: &ScrubConfig) -> String
Expand description

Scrub text using an explicit policy.

use textprep::{scrub_with, ScrubConfig, ScrubNormalization, ScrubCase};

let cfg = ScrubConfig {
    normalization: ScrubNormalization::Nfkc,
    case: ScrubCase::Lower,
    strip_diacritics: true,
    collapse_whitespace: true,
    ..ScrubConfig::default()
};
assert_eq!(scrub_with("  Ångström  Units  ", &cfg), "angstrom units");