remove_diacritics
Removes diacritical marks (accents) from s, e.g. "café" → "cafe".
Works by Unicode-decomposing each character into its base letter plus combining marks
('é' → 'e' followed by a combining acute accent), then dropping the marks. Needs the
string-diacritics feature (not string alone, and not in default): full Unicode
normalization needs a real decomposition table, unlike the rest of this module, which is
dependency-free.
Import
Section titled “Import”Cargo feature string-diacritics (opt-in): it enables string and adds the unicode-normalization dependency. On top of the default features:
or with only this module:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
s | &str | The text to strip diacritics from. |
Returns
Section titled “Returns”String — s with diacritics removed; unchanged if it has none.
