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