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

137
Vistas
I'm writing a function to compare to music artist strings, but come in different formats. Would would be a suggested approach?

Overview:

I'm writing a function to compare to music artist strings, but come in different formats. Would would be a suggested approach?

Example Strings (Both are from the same song, just formatted differently):

// Eli & Fur & Brothertiger
// Brothertiger, Eli & Fur

Question:

What would be the suggested approach to compare these strings that I could match both artists "Eli & Fur & Brothertiger" and "Brothertiger, Eli & Fur"?

Possible Options:

  • Use string.split(',') on songTitle, then for loop over each string
  • Use string.split('&') on songTitle, but then that gets messed with with an artist name such as "Eli & Fur" with a "&" in it.
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'd split by either & or a comma.

const toArr = str => str.split(/ *(?:&|,) */);
console.log(toArr('Eli & Fur & Brothertiger'));
console.log(toArr('Brothertiger, Eli & Fur'));

Then check that the lengths are the same and that every element of one array exists in the other.

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