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

136
Visualizações
how do i remove \n and \r in from aReadStream text file

so i need to get from a text file alot of data and when i use fs.createReadStream and copy the data to a varible and start changing it it looks like \n and \r and present and the are messing my splits and array checking and i tried to do a function that removes them that runs on the array and checks for ''(it doesnt work for some reason)

if(arr[i]==='\'(this throws the mistake){**strong text**
(removing it and stuff)
}

do you have any idea how to remove it?

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

0

You can either use the String prototype replaceAll, or work with split and join:

let data = '\r \n sdfsdf. \r'

data = data.replaceAll(`\r`, '')
data = data.replaceAll(`\n`, '')



OR ------------------------

let data = '\r \n sdfsdf. \r'

data = data.split(`\r`).join('').split(`\n`).join()


Pay attention - replaceAll is a new prototype and exists only on Node v.15+ and the latest versions of the modern browsers. See MDN documents to check your needs.

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