Convert scientific notation to decimal

Highlighted
Eight Stars
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
Highlighted
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());

View solution in original post


All Replies
Highlighted
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());

View solution in original post

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog