Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
I have a function which takes a string parameter, but the value is a Double from Salesforce.
How do I convert a Double to String?
From the apex documentation:
Double myDouble = 12.34; String myString = String.valueOf(myDouble);
I got a "Comparison arguments must be compatible types: Double, String" error message
the Fn_outcall.saveobj(str) function takes a string parameter.
here is the code:
for(Ori__c o: Trigger.New){
Steven_Outcall.SaveOriginator(str);
}
I have this conversion:
String value = '6000';String CR = String.valueOf(Double.valueOf(value) / 2.00000);system.debug('CR: ' + CR);
and the developer console returns
CR: 3E+3
but I want:3000
after to review the documentation a good solution is:
String value = '6000';String CR = (Double.valueOf(value) / 2.00000).format().remove(',');system.debug('CR: ' + CR);
From the apex documentation:
Double myDouble = 12.34; String myString = String.valueOf(myDouble);
I got a "Comparison arguments must be compatible types: Double, String" error message
the Fn_outcall.saveobj(str) function takes a string parameter.
here is the code:
for(Ori__c o: Trigger.New){
if (o.AID__c != null && o.AID__c <>''){ String str = String.valueOf(o.AID__c);Steven_Outcall.SaveOriginator(str);
}
}
}
o.AID__c
won't work
I have this conversion:
String value = '6000';
String CR = String.valueOf(Double.valueOf(value) / 2.00000);
system.debug('CR: ' + CR);
and the developer console returns
CR: 3E+3
but I want:
3000
after to review the documentation a good solution is:
String value = '6000';
String CR = (Double.valueOf(value) / 2.00000).format().remove(',');
system.debug('CR: ' + CR);