tMap Expression - Replace Chr(10), Chr(13), Chr(9) With Spaces

Five Stars

tMap Expression - Replace Chr(10), Chr(13), Chr(9) With Spaces

Hello everyone,

 

I had to replace hidden characters in  field sourced from MSSQL, though I've already found a working solution I'm curious about something in it.

 

Issue: "\n" in data ending the line in the target file.

Solution: row1.field.replaceAll("\r\n"," ").replaceAll("\n"," ")

For me, the above solution as well as just row1.field.replaceAll("\n"," ") has worked well.

 

I just want to know how the two replaceAll placed one after another actually work.


Accepted Solutions
Forteen Stars

Re: tMap Expression - Replace Chr(10), Chr(13), Chr(9) With Spaces

as per the solution, first row1.field.replaceAll("\r\n"," ") will exectue and to the oput of row1.field.replaceAll("\r\n"," ")  is passed to replaceAll("\n"," ") will replace \n to empty string.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Tags (1)

All Replies
Forteen Stars

Re: tMap Expression - Replace Chr(10), Chr(13), Chr(9) With Spaces

as per the solution, first row1.field.replaceAll("\r\n"," ") will exectue and to the oput of row1.field.replaceAll("\r\n"," ")  is passed to replaceAll("\n"," ") will replace \n to empty string.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Tags (1)

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads