Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 2x 9x | const DIACRITICS_PATTERN = /\p{M}/gv;
/**
* Removes the accents of a text (`Été` → `Ete`), to search or sort without them. `ø`, `ß` or `æ` stay.
*
* @param input - The text.
* @returns The text without combining marks.
* @example
* removeDiacritics('Crème brûlée à Évian'); // 'Creme brulee a Evian'
*/
export function removeDiacritics(input: string): string {
return input.normalize('NFD').replaceAll(DIACRITICS_PATTERN, '');
}
|