pub fn flatten_str(s: impl AsRef<str>) -> String
Expand description
Normalizes a string by performing ASCII transliteration and converting to lowercase.
This uses the [unidecode] crate to approximate non-ASCII characters with their closest ASCII equivalents, and then converts the entire string to lowercase. Then, remove any non-alphanumeric character and consecutive whitespaces, returning the trimmed string.
§Examples
let text = "Héllö Wörld! (-123) ";
let flattened = flatten_str(text);
assert_eq!(flattened, "hello world -123");