DecimalFormatter with thousands separator 0 value returning .00

Rubick :

I have a problem formatting on my result on the android app.

I'm using a DecimalFormat with a format of "###,###.00". now, The big number 100000.0 returning 100,000.00 which is correct. but when I parse 0 the result is only .00. How can I make it 0.00.

Note: I have tried to use String.format extending ("%.2f",value) but the problem is when it reach the 10000.0 amount, it returns 10,0000.00.

Elliott Frisch :

Change the format of "###,###.00" to

"###,##0.00"

When you use # that makes it optional, when you use 0 it is required.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324881&siteId=1