I am developing a calculator for android
.
Having a double
field called result
, which I then put into a TextView
.
If say result = 20.0
then I must represent it as 20
(without point and a zero). If result = 20.0001
it should be displayed unchanged.
Now I do it with regular expressions but I guess it's not a good idea. Is there another way to represent double without a point and a zero if double actually is an integer (without digits after the point)?