The issue is, your string is not a valid numeric value. You are trying to convert a blank string to the numeric datatype, that is not going to work. You need to validate that the string is not null and not equal to '' before the conversion. Would work the same for the double.
The issue is, your string is not a valid numeric value. You are trying to convert a blank string to the numeric datatype, that is not going to work. You need to validate that the string is not null and not equal to '' before the conversion. Would work the same for the double.
String a = '';
Decimal DebitAmount;
a='23.9';
if((a<>null)&&(a<>'')){
DebitAmount = decimal.valueOf(a);
}
system.debug('\n\n String a='+a);
system.debug('\n\n Decimal DebitAmount='+DebitAmount);