+ Start a Discussion
sgoldberRHsgoldberRH 

String to Double?

Is it possible to convert a Double to a string?  I have a date that is part of a string, and I want to pull out of the date and convert it to a double, but I can't figure out how? 

 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
mikefmikef

You can use Decimal instead of Double, in Apex they are synonym data types.

So something like this.

 

 

String myString = '2009'; Decimal myDecimal = decimal.valueOf(myString);

 

 

 

All Answers

mikefmikef

You can use Decimal instead of Double, in Apex they are synonym data types.

So something like this.

 

 

String myString = '2009'; Decimal myDecimal = decimal.valueOf(myString);

 

 

 

This was selected as the best answer
sgoldberRHsgoldberRH

Mike,

 

Thanks that worked perfectly.