You need to sign in to do that
Don't have an account?
VisualForce
Convert Double to Integer
HI..
How to convert double value into integer..
My code is
integer percent;
double total;
public integer getPercentage()
{
percent=integer.valueof(total);
return percent;
}
here total is double value..
While I click runtest I got
System error : Type Exception
Invalid Integer 0.0
I need a round value...
Now I am using
double percent;
double total;
public double getPercentage()
{
percent=Math.round(total);
return percent;
}
I got a answer like 10.0 (with .0) .. I want to display 10 only..
integer percent;
double total;
public integer getPercentage()
{
string temp=string.valueof(total);
percent=integer.valueof(temp);
return percent;
}
The above code is deployed without error.. When I run this page I got a error like invalid integer 10.334532421
This visual force page is used for PDF generation ...
Thanks for ur reply..
I got error Method does not exist while I use this code
x = double.intValue(y);
But I change into
x = y.intValue();
Now its work...
Thanks once again....
All Answers
Thanks for ur reply..
I got error Method does not exist while I use this code
x = double.intValue(y);
But I change into
x = y.intValue();
Now its work...
Thanks once again....
This is the correct format. Hope it helps you.