removeDiacritics
Removes diacritical marks (accents) from a string, e.g. 'café' → 'cafe'.
Works by Unicode-decomposing each character into its base letter plus
combining marks ('é' → 'e' + a combining acute accent), then
stripping the marks. Same technique already used internally by slugify.
Available since v3.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
str | string | The string to strip diacritics from |
Returns
Section titled “Returns”string — The string with diacritics removed
Examples
Section titled “Examples”Strip accents from a string
Section titled “Strip accents from a string”Useful for accent-insensitive search or generating ASCII-safe identifiers.
Plain ASCII text is left unchanged
Section titled “Plain ASCII text is left unchanged”Only characters with combining diacritical marks are affected.
