File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
formatting integer to include commas
Joined: Jun 01, 2004
Jun 11, 2004 07:47:00
All I'm wanting to do is format an integer to include commas in the proper places... if I use
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
Joined: Oct 26, 2000
Jun 11, 2004 08:28:00
Check out the API for
, it should help you out. Take a look.
My theory of evolution is that Darwin was adopted. - Steven Wright
Joined: Sep 13, 2002
Jun 11, 2004 08:29:00
which is a concrete subclass of
. You can use it to specify the exact mask you want to apply, like this:
DecimalFormat df = new DecimalFormat("#,###"); System.out.println("DateFormat: " + df.format(1000));
I believe that will give you the result you are looking for.
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
I agree. Here's the link:
subject: formatting integer to include commas
Illegal format conversion exception for printf
numeric literals that include comma, beware of this
4b - input arg question
How to read CSV?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015