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

Highlighted
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
Highlighted
Moderator

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 when a reply is helpful and click Accept the solution when you think you're good with it.

View solution in original post

Tags (1)

All Replies
Highlighted
Moderator

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 when a reply is helpful and click Accept the solution when you think you're good with it.

View solution in original post

Tags (1)

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog