Convert from double to integer

One Star Amk
One Star

Convert from double to integer

my source is a flat file ,data has value which may or maynot be a decimal (eg.12345.89 or 3456),we want only the integer part of it and not the decimal part of it(eg 12345 and not 12345.89)
I am creating a variable ,
StringHandling.INDEX(row1.id,".") == -1 ? StringHandling.LEN(row1.id) : StringHandling.INDEX(row1.id,".")
and another variable ,
Integer.parseInt(StringHandling.LEFT(row1.id,Var.index))
It is working fine and i am getting the required output,but i still want to know if there is any other better way for resolving this requirement
Thanks in advance,
Amk
One Star Lie
One Star

Re: Convert from double to integer

Hi,
I think you can use this :
Double.parseDouble(row1.id).intValue()

Regards,
Lie
One Star Amk
One Star

Re: Convert from double to integer

Thank you Lie,I will try and get back to you...
Regards,
Amk

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download