I know there's a lot of posts on this, but the answers are not working for me. Here's a link with good answers - but did not work for me: How to remove all line breaks from a string
and this is how I tried to remove tgh CR LF:
let newdata: string = JSON.stringify(data);
newdata =new String(newdata).valueOf();
// newdata = newdata.replace(/(\r\n|\n|\r)/gm, '');
newdata = newdata.replace(/\r?\n|\r/g, '');
and I will post bothe a screenshot of the string in notepad++ so you can see it, then I will paste the string below if you want to test it.
and this is the string:
[{"type":"-","name":"aaSomeFile - Copy.txt","size":12,"modifyTime":1664204606000,"accessTime":1664981500000,"rights":{"user":"rw","group":"***","other":"***"},"owner":0,"group":0,"longname":"-rw-****** 1 - -
12 Sep 26 11:03 aaSomeFile - Copy.txt"},{"type":"-","name":"SomeFile.txt","size":12,"modifyTime":1664204606000,"accessTime":1664204606000,"rights":{"user":"rw","group":"***","other":"***"},"owner":0,"group":0,"longname":"-rw-****** 1 - - 12 Sep 26 11:03 SomeFile.txt"},{"type":"-","name":"SomeFile1.txt","size":12,"modifyTime":1664204606000,"accessTime":1666806607000,"rights":{"user":"rw","group":"***","other":"***"},"owner":0,"group":0,"longname":"-rw-****** 1 - - 12 Sep 26 11:03 SomeFile1.txt"},{"type":"d","name":"TestFolder1","size":0,"modifyTime":1667511799000,"accessTime":1667511799000,"rights":{"user":"rwx","group":"***","other":"***"},"owner":0,"group":0,"longname":"drwx****** 1 - - 0 Nov 3 17:43 TestFolder1"},{"type":"-","name":"zzzSomeFile2.txt","size":12,"modifyTime":1664204606000,"accessTime":1666806623000,"rights":{"user":"rw","group":"***","other":"***"},"owner":0,"group":0,"longname":"-rw-****** 1 - - 12 Sep 26 11:03 zzzSomeFile2.txt"}]
Can anyone tell me how this can be removed?
Thank you.