Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to remove decimal points from string field and round off

Hello Folks,

 

I am new to Talend. I need below help.

 

I have input .like this which is String type in .csv file. 

3040000000005.78

 

And I want to convert this to 3040000000006

 

This has removing decimal and round off to nearest integer.

 

Regards,

Deepak

Labels (4)
1 Reply
Anonymous
Not applicable
Author

There is a quite a straight forward answer to this using the BigDecimal class. Try this in a tJava component....

 

String stringNum = "3040000000005.78";
BigDecimal bd = new BigDecimal(stringNum);

System.out.println(bd.setScale(0, BigDecimal.ROUND_HALF_UP).toPlainString());