I got this problem with double (decimals).
When a double = 1.234567 Then I use String.format("%.3f", myString);
So the result is 1.234
But when my double is 10
The result will be 10,000
I want this to be 10
Is their a way to say that he only needs to show the decimals when it is "usefull"?
I saw some posts about this, but that was php or c#, couldn't find something for android/java about this (maybe I don't look good).
Hope you guys can help me out with this.
Edit, for now I use something like this: myString.replace(",000", "");
But I think their is a more "friendly" code for this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…