Seven Stars

how to remove white space for integer column values in talend

Hi Talend Folks,

I want to remove white space for integer column values in database using talend.

whether it is possible or not ?

 

input

s.no 

   0000 

 

output 

s.no

0000

RAJESH J
1 ACCEPTED SOLUTION

Accepted Solutions
Thirteen Stars

Re: how to remove white space for integer column values in talend

Yes, this is pretty straight forward. Just place the following code in a tMap (or similar)....

 

row.columnWithSpaces.replaceAll(" ", "")
Rilhia Solutions
4 REPLIES
Thirteen Stars

Re: how to remove white space for integer column values in talend

Yes, this is pretty straight forward. Just place the following code in a tMap (or similar)....

 

row.columnWithSpaces.replaceAll(" ", "")
Rilhia Solutions
Seven Stars

Re: how to remove white space for integer column values in talend

Hi

I tried it's not working for integer column

 

row1.S_NO.replaceAll(" ","") 

RAJESH J
Thirteen Stars

Re: how to remove white space for integer column values in talend

This is not an Integer column if it has a space in it or starts with a 0. A number cannot start with a 0 unless it is 0. What you have is a String column which holds your data as "  0000 ". You need to remove the spaces in the way I demonstrated, and that will leave "0000". If you convert that to an Integer it will leave 0. 

Rilhia Solutions
Seven Stars

Re: how to remove white space for integer column values in talend

Hi

Thank you for your help

RAJESH J