How to sort array of strings disregarding accents?

Asked

Viewed 2,705 times

15

If I have an array like the following:

exemplo = ["Árvore", "Casa", "Computador", "É", "Poste", "Pássaro", "Índia", "Ar", "Ásia"]

The exemplo.sort() considers the accentuation of the words to order, placing the accented last:

exemplo.sort()
["Ar", "Casa", "Computador", "Poste", "Pássaro", "Árvore", "Ásia", "É", "Índia"]

How to get the array sorted by disregarding accents?

  • Related (but not exactly duplicate): http://answall.com/questions/3994/comor-fazer-uma-busca-ignorando-acentuaca-em-javascript

1 answer

16


  • 1

    Much simpler than I imagined! I was already thinking about using regex.

  • 1

    My, I was going to give a job ein! rsrsrs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.