Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

113
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda