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