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
bca321bca321 

apex

Message Edited by bca321 on 03-05-2009 04:11 AM
JimRaeJimRae

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);

 

 

Message Edited by JimRae on 03-04-2009 03:39 PM