How can I remove line breaks in Suitescript? Regex...
# suitescript
e
How can I remove line breaks in Suitescript? Regex are a mistery to me. The item description are created with copy/paste by the users, and sometimes a line breaks is included at the end of a string. I generate a CSV with a Suitelet, but line breaks are a problem in the output.
b
if you want to keep the line breaks, then you may want to consider properly implementing csv and use quoted values
you may want to actually consider papaparse for a proper implementation
e
I don't want the line breaks
s
Really is not suitescript specific, same way you would do it to any string in java. Just google/stackexchange that exact thing and take someone's regex already out there. Linebreak really isn't as always as simple as looking for
\n
b
if you dont want to use regular expressions, then you must use replace multiple times
e
Thanks @Sandii @battk
👍 1
c
It's a pain in the arse.
I get the same issue with records coming through Celigo, I have to put some horrible handlebars script into the record import mapping to remove various bad characters.