You need to sign in to do that
Don't have an account?
Marcelo Agostinho
Round a number
Hello. Again i'm here to make some questions.
I'm building an URL to send it ro Google Chart API and it will return an image.
What i need to do is get the maximum value of the Chart data and round up it to An integer...
For example...
If my maximum value is 2475.59 i want to convert it to a string and round up to 2500.
Can i do it?
Anyone can help me?
Tks
You'll need to figure out how much you want to round to, and then do the appropriate math. In your example, you might do:
This would convert 2475.59 to 24.7559, then rounded to 25.0000, then multiplied back, becomes 2500.00. From there, String.valueOf takes care of the conversion from a number to a string value.
All Answers
You'll need to figure out how much you want to round to, and then do the appropriate math. In your example, you might do:
This would convert 2475.59 to 24.7559, then rounded to 25.0000, then multiplied back, becomes 2500.00. From there, String.valueOf takes care of the conversion from a number to a string value.
Very Tks to you sfdcfox its works perfectly