Files
30-seconds-of-code/snippets/removeAccents.md
Isabelle Viktoria Maciohsek 8bf67754ce Make expertise a field
2022-03-01 20:21:45 +02:00

552 B

title, tags, expertise, firstSeen, lastUpdated
title tags expertise firstSeen lastUpdated
Remove accents string beginner 2020-10-04T02:23:40+03:00 2020-10-22T20:24:04+03:00

Removes accents from strings.

  • Use String.prototype.normalize() to convert the string to a normalized Unicode format.
  • Use String.prototype.replace() to replace diacritical marks in the given Unicode range by empty strings.
const removeAccents = str =>
  str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
removeAccents('Antoine de Saint-Exupéry'); // 'Antoine de Saint-Exupery'