Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on seperators in currency format.

 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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......

Thanks,
Raj.
 
Raymond Tong
Ranch Hand
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic