Six 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.

1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars

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());
Rilhia Solutions
1 REPLY
Twelve Stars

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());
Rilhia Solutions