Reputation: 11
With string.format introduced in Java 5, is decimalformat now obsolete? I'm having a hard time finding something you can do in decimalformat that you can't do in string.format.
Upvotes: 1
Views: 2434
Reputation: 11996
There is some stuff like automatic promilles and currency symbol substitution. But it is nothing that you can't do better with proper localisation of your own.
Upvotes: 0
Reputation:
String.format is a static method call but you can create a DecimalFormat instance and reuse a previously specified format.
Upvotes: 1
Reputation: 15792
Using decimalformat is preferable as it have Locale and other stuff
Upvotes: 1