user2242817
user2242817

Reputation: 3

DecimalFormat thousandths separator

I'm trying to set an apostrophe separator for the decimal format for a fractional number with a millionth place. I am getting a malformed pattern error.

String text = ".000'000";
DecimalFormat dformat = new DecimalFormat(text);

What is the correct string to use?

Upvotes: 0

Views: 1137

Answers (1)

Dawood ibn Kareem
Dawood ibn Kareem

Reputation: 79848

As described on http://docs.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html, you need two single quotes, one after the other. The first will be seen as an escape character.

Upvotes: 3

Related Questions