Convert scientific notation to decimal

Eight Stars RAJ
Eight Stars

Convert scientific notation to decimal

Hi Talend Folks,

 

Convert scientific notation to decimal
  

I currently have a string field that contains scientific notation values. I would like to convert these to decimal.

Thanks in advance for your help!!

Example

Current format                           Needed Format

-1.9178464696202265E-2 -->     -0.01917846469620226500

 

 

Note: I have a urgent requirement. How to solve this issues?. Please Help me friends.

 Whether it is possible to convert format using encoding option when i import csv file.

Thanks
RAJ

Accepted Solutions
Community Manager

Re: Convert scientific notation to decimal

You can use the BigDecimal class for this. The following code can be placed in a tJava component to demonstrate how it works....

 

String value = "5.1234E-09";
BigDecimal bd = new BigDecimal(value);

System.out.println(bd.toPlainString());

All Replies
Community Manager

Re: Convert scientific notation to decimal

You can use the BigDecimal class for this. The following code can be placed in a tJava component to demonstrate how it works....

 

String value = "5.1234E-09";
BigDecimal bd = new BigDecimal(value);

System.out.println(bd.toPlainString());

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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