Split and Interchange string text

Highlighted
Five Stars

Split and Interchange string text

Hi all,

 

I want to split the string into two halves and then interchange in the tmap.

Ex: my string is of length 8,  ABCDEFGH

I want the output as EFGHABCD

 

Please suggest a solution.


Accepted Solutions
Employee

Re: Split and Interchange string text

Hi,

 

   Assuming the input is a not null column and always have 8 characters, please see the solution below.

image.png

 

image.png

 

row1.data.substring(4,8)+row1.data.substring(0,4)

You can check the length of the string as a parameter to function, if you want to change it dynamically for varying string length.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)


All Replies
Employee

Re: Split and Interchange string text

Hi,

 

   Assuming the input is a not null column and always have 8 characters, please see the solution below.

image.png

 

image.png

 

row1.data.substring(4,8)+row1.data.substring(0,4)

You can check the length of the string as a parameter to function, if you want to change it dynamically for varying string length.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

Five Stars

Re: Split and Interchange string text

Thanks for the Perfect response.
I needed this implementation in interchanging different date formats where i get feed name_date differently. It solved my issue.

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download