Arto Uusikangas
Arto Uusikangas

Reputation: 1909

How to set decimal separator in DecimalFormat to empty

I want to format a number from this 3,004 to this 30040. Or 0,034 to 340.

With DecimalFormat i cant set the Decimalseparator to ''. So how to achieve this?

Double test = resultSet.getDouble("somedoublefield");
DecimalFormatSymbols fts = new DecimalFormatSymbols();
fts.setDecimalSeparator('');
DecimalFormat ft = new DecimalFormat("#0.0000",fts);

Upvotes: 2

Views: 3271

Answers (1)

Santosh
Santosh

Reputation: 17913

You need to create DecimalFormatSymbols object with right Locale you are dealing with. You can use German locale as follows

DecimalFormatSymbols fts = new DecimalFormatSymbols(Locale.GERMAN);

Check this link.

Upvotes: 2

Related Questions