I need to convert String
into Decimal
. the isNumeric() method is retuning false
if value is Decimal
. Another alternate:
try
{
Integer x = Integer.valueOf(myString);
}
catch (exception e)
{
// it's not an Integer, try something else
}
Is there any other way to convert Decimal
into String
?
Note: value which is coming can be Integer
or String
.
Best Answer
IsNumeric() method works for only Integer value not for decimal value
like this
This will return true.
Run this code in developer console ad check output.
In you case do something like. First convert string to numeric then check and again convert string into decimal for future use
Don't understand why you need this.