-
Notifications
You must be signed in to change notification settings - Fork 0
replaceAccentedCharacters
Mike Byrne edited this page Mar 14, 2023
·
1 revision
Introduced 3.1.0
Replace accented characters (Diacritics) with regular ASCII characters - so characters like é will be replaced by e.
A common use case is string matching searches where users may not enter accented characters but would expect to see results that include accented characters ; especially when it comes to names. For example, users may search Simon Bolivar but want to see results for Simón Bolívar.
- nothing
- str - required - string to replace diacritics in
- string with accented characters replaced
let str = replaceAccentedCharacters(`Hernán Cortés de Monroy y Pizarro Altamirano`); // 'Hernan Cortes de Monroy y Pizarro Altamirano'Note some characters like ß as in the German straße (street) won't be replaced for ss - ß isn't an accented character, it is a character in its own right.