File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Doubt on seperators in currency format. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Doubt on seperators in currency format." Watch "Doubt on seperators in currency format." New topic

Doubt on seperators in currency format.

Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 445


I need to format currency values that are displayed in the project I am involved with at the moment. The below code does that perfectly fine for me :-

The problem I'm facing is with the separators. I want the currency values to be formatted in '##,##,###.##' format and not '#,###,###.##'. I read on the specifications, that by default that is how numbers are formatted using patterns and if the sequence is not recognized, the remainder of the format string is ignored. IS there a possible way to get around this using DecinalFormat based formatting options?

N.B I am not looking to play with substring() and indexOf() functions......

Raymond Tong
Ranch Hand

Joined: Aug 15, 2010
Posts: 238

The format seems to be non-standard and can't be used with DecimalFormat.
There was a discussion which came up with custom formatting using regular expresson.
Indian decimal format pattern
I agree. Here's the link:
subject: Doubt on seperators in currency format.
It's not a secret anymore!