• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

formatting integer to include commas

 
Bill Brasskey
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All I'm wanting to do is format an integer to include commas in the proper places... if I use NumberFormat class and set min and max fraction digits to "0" , will this work? I dont want the period at the end, either.
ex. 1000 to 1,000
 
Eric Fletcher
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the API for DecimalFormat, it should help you out. Take a look.

HTH,
E
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use DecimalFormat which is a concrete subclass of NumberFormat. You can use it to specify the exact mask you want to apply, like this:

I believe that will give you the result you are looking for.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic