DecimalFormat without comma

Discussion in 'Java' started by Jackson, Nov 17, 2005.

  1. Jackson

    Jackson Guest

    I want to format the number without the comma.
    int num = 1000.123;
    java.text.numberFormat nf = java.text.numberFormat.getInstance();
    nf.setMaximumFractionDigits( 10 );
    nf.format( num );

    this returns "1,000.123" but i want instead "1000.123" how can i do?

    S
    Jackson, Nov 17, 2005
    #1
    1. Advertising

  2. Jackson

    Roedy Green Guest

    Roedy Green, Nov 17, 2005
    #2
    1. Advertising

  3. Jackson

    Sujay Guest

    it is possible by defining a DecimalFormatt as "########.##0"
    Sujay, Nov 17, 2005
    #3
  4. Jackson

    Pete Barrett Guest

    On Thu, 17 Nov 2005 00:47:08 GMT, "Jackson" <> wrote:

    >I want to format the number without the comma.
    >int num = 1000.123;
    >java.text.numberFormat nf = java.text.numberFormat.getInstance();
    >nf.setMaximumFractionDigits( 10 );
    >nf.format( num );
    >
    >this returns "1,000.123" but i want instead "1000.123" how can i do?
    >

    Try NumberFormat.setGroupingUsed(false).

    Pete Barrett
    Pete Barrett, Nov 17, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Johnny

    DecimalFormat

    Johnny, Oct 25, 2003, in forum: Java
    Replies:
    10
    Views:
    7,830
    A Dahlman
    Oct 27, 2003
  2. Timo Nentwig

    Padding for DecimalFormat?

    Timo Nentwig, Jan 5, 2004, in forum: Java
    Replies:
    3
    Views:
    4,474
    Tony Dahlman
    Feb 12, 2004
  3. Cliff
    Replies:
    5
    Views:
    527
    Roedy Green
    May 12, 2004
  4. Adam Lipscombe
    Replies:
    2
    Views:
    762
    Virgil Green
    Nov 29, 2004
  5. Mark Sizzler
    Replies:
    1
    Views:
    1,399
    Roland
    Feb 21, 2005
Loading...

Share This Page