function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
iceberg4uiceberg4u 

Converting String to Double.

Hi,

 

I have started facing problems with Double.valueOf(<String>) method.Whenever I send in a String value, the value becomes <smthn>E<smthn>. 

 

Suppose I take a value of "11111111111" I get value as <smthn>E9.I get an error as "unexpected token: E9".

 

Suppose I take a value of "1111111111" I get value as <smthn>E8.I get an error as "unexpected token: E8".

 

What modification do I need to do for this??

micwamicwa
What would you like to do with the double value? I tested summing different values up, this works.
iceberg4uiceberg4u

I am using the results to do some processing.The results are then sent to a dynamice SOQL.

Some portions of the code:

 

private String m_AmountDue;

 

public String AmountDue

{

     get{return m_AmountDue}

      set{m_AmountDue = value;}

}

 

m_AmountDue = m_AmountDue.trim();

m_AmountDue = m_AmountDue.replace(',','');
Double amountDueDoubleVal =  Double.valueOf(CommonHelper.getDoubleValue(m_AmountDue,''));//I get the error here.

Double maxAmount = 0.2 * (CommonHelper.IsNull(amountDueDoubleVal));

Double minAmount = CommonHelper.IsNull(amountDueDoubleVal) - CommonHelper.IsNull(maxAmount);

 

I hope this helps..