How can I remove new lines along with extra spaces.
For example the following text:
"This is a bio with an extra space. And an extra line
between the lines"
would become:
“This is a bio with an extra space. And an extra line between the lines”
Is there a way to do this WITHOUT regex?
Just curious, why would you not want to use regex?
There are escape sequences in js and regex
You can see a list here: https://regex101.com
The function replace
is regex enabled
Then you also need the global modifier:
text.replace(/\n/g, '')
system
Closed
5
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.