One Star

CR/LF and removing extra ones

Any know the best way of removing cr/lf or just lf from a string ?
My file looks like this;
"AAAAAA","bbbbbb","CCCCCCC\r\n
CCCCCC","dddddd"

I'd like to get to;
"AAAAAA","bbbbbb","CCCCCCCCCCCCC","dddddd"
Thanks
1 REPLY
Seven Stars

Re: CR/LF and removing extra ones

I think you need to read the file using tFileInputDelimited with CSV options and then use tJavaRow to remove the linefeeds.
If the linefeed is always in the same field, just use e.g. output_row.field3 = input_row.field3.replace("\\r\\n\r\n","");
If you don't know which field has the linefeed or it can change from row to row, you'll have to use reflection to loop through all the fields doing the replace. I've never used reflection myself, having only very basic Java knowledge but this topic (http://www.talendforge.org/forum/viewtopic.php?id=14940) should help you hopefully.