Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

109
Visualizações
Efficient way to use locale sensitive strings as keys to a data structure

What is the most efficient way to key a data-structure using locale sensitive strings.

I essentially want a sorted TreeMap with the comparison algorithm for the sort being a.localeCompare(b, locale, { sensitivity: 'base' }).

The ideal method would be to have some sort of normalize/conversion such that a.convert() === b.convert() for all a and b where a.localeCompare(b, ...) returns 0. Then I could use the result of that conversion as the key for a hashMap like javascript objects or Map.

Alternatively is there a known sorted TreeMap where I could specify the comparison of the keys?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I used npm parameterize library to create a locale insensitive key. The function provided takes a utf-8 string and turns it into a relatively readable lowercase string. This then can be used for a hash code in a hashmap. So 'Résumé' and 'resume' would both map to the same item in the hashmap.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda