Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
JohnJ
Contributor
Contributor

Problem removing end of line carater

Hi the community,

This looks like a common begginer issue, but I can't find solving it.

I am using Talend Open studio 7.3, I am gathering data using a Trest request.

This gets me a string "Body" and an Integer "Error".

My probleme is that in the string (which is a json information), I got those caracter withing the string:

..."parameter_alias":"","value":"example\r\n$(95)$","default":"No"...

that \r\n really bothers me, since when I then parse that into the json component it creates me 2 lines.

for my attemps, I put a tlogrow before and after the tMap and then I replaced the tMap with a treplace.

I tried many things:

first I went with the row1.body.replace("\\n", " ") in a tMap => not working.

I tried with "\n", not working (normal)

I tried with "\\\n", not working (normal but eh...I was thinking something went wrong so why not test that)

Now I thought the \r maybe the bothering one within all of this so:

I tried "\\r\\n|\\r|\\n"..... not working. 😞

I tried with the StringHandling.EREPLACE(row1.Body,"\\n", " ") and all the other value above => not working.

I then tried this: StringHandling.EREPLACE(row1.Body,"\\r\\n|\\r|\\n", " ") => not working

I then tried with the Treplace component also, and again, can't make it work. That damn \r\n stays in the string....

Anyone has an idea?

Labels (2)
2 Replies
Prakhar1
Creator III
Creator III

 1) row1.body = row1.body.replaceAll("\\n", " ")

row1.body = row1.body.replaceAll("\\r", " ")

or

 1) row1.body = row1.body.replaceAll("\\\\n", " ")

row1.body = row1.body.replaceAll("\\\\r", " ")

JohnJ
Contributor
Contributor
Author

Thanks a lot Prkhar,

 

it's working with 4 \ => I used that StringHandling.EREPLACE(row1.Body,"\\\\r\\\\n", " ")