I have a double value which I have to display at my UI. Now the condition is that the decimal value of double = 0 eg. - 14.0 In that case I have to show only 14 on my UI. Also, the max limit for characters is 5 here.
eg.- 12.34 the integer value can be no bigger than 2 digits and so is the decimal value for our double.
What could be the best way of doing this?
You could simply do
d % 1 == 0
to check if double d
is a whole.