Join a string with multiple line breaks into one line

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2022 11:10 AM
Hello SN community
I'm trying to create a script that can merge the content of a variable in just one line
myString:
Prxzxdos,
xom dix!
Rxf.: xxixx xxnxfício Trixutário
Solicitxmos xxixx dx xxnxfício trixutário do vxículo xm rxfxrêncix pxrx inclusão dx xrxvxmx.
gxSaI:93XHYKL1TPCN55307
RxNxVxN: 01301908433
PLxCx: QLZ6x34
UF: xC
This string will basically contain all the text of emails received in my process
When trying to apply commands like index(of) and substring I noticed that I can only use them after leaving the mass of data on a single line
Can you give me some guidance?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2022 11:30 AM
Hi
You can try something like this.
var newString = <your_string>.replace(/\n/g, '\n');
Regards,
Muhammad
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2022 11:34 AM
if the Above doesn't help then you can try something like Alikutty suggested on the below link
Regards,
Muhammad
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2022 01:52 PM