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

138
Visualizações
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 Respostas
Responde à pergunta

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 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