How to convert a double into a currency string

Discussion in 'Java' started by Chris Baker, Sep 21, 2003.

  1. Chris Baker

    Chris Baker Guest

    I know that there is an easy way to convert a double to a currency string,
    but i can't seem to figure it out. I'm looking to convert a double like
    4.5233 to a dollar amount like $4.52. any help is appreciated, and thanks in
    advance!

    ------------
    ~Chris Baker
    Sophomore Computer Science Student
    Co-VP of MUFencing
    Miami University (OH)
    Chris Baker, Sep 21, 2003
    #1
    1. Advertising

  2. Chris Baker

    VisionSet Guest

    "Chris Baker" <bakermc(at)muohio.edu> wrote in message
    news:...
    > I know that there is an easy way to convert a double to a currency string,
    > but i can't seem to figure it out. I'm looking to convert a double like
    > 4.5233 to a dollar amount like $4.52. any help is appreciated, and thanks

    in
    > advance!
    >


    java.text.NumberFormat.getCurrencyInstance().format(45.63563564)); // locale
    specific

    or

    new java.text.DecimalFormat("$0.00").format(45.63563564));


    --
    Mike W
    VisionSet, Sep 21, 2003
    #2
    1. Advertising

  3. Chris Baker

    Roedy Green Guest

    On Sun, 21 Sep 2003 16:23:41 -0400, "Chris Baker"
    <bakermc(at)muohio.edu> wrote or quoted :

    >I know that there is an easy way to convert a double to a currency string,
    >but i can't seem to figure it out. I'm looking to convert a double like
    >4.5233 to a dollar amount like $4.52. any help is appreciated, and thanks in
    >advance!


    see http://mindprod.com/jgloss/currency.html

    see http://mindprod.com/converter.html

    see http://mindprod.com/jgloss/floatingpoint.html

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Sep 22, 2003
    #3
    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. KB
    Replies:
    3
    Views:
    20,853
    Pabinator
    Aug 28, 2009
  2. =?Utf-8?B?QUNhdW50ZXI=?=

    convert double to currency

    =?Utf-8?B?QUNhdW50ZXI=?=, Jan 19, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    6,418
    William F. Robertson, Jr.
    Jan 19, 2005
  3. Sydex
    Replies:
    12
    Views:
    6,471
    Victor Bazarov
    Feb 17, 2005
  4. AviraM
    Replies:
    2
    Views:
    6,352
    Manish Pandit
    Sep 28, 2006
  5. =?Utf-8?B?R3JlZyBH?=

    Convert currency formated string back into decimal

    =?Utf-8?B?R3JlZyBH?=, Nov 3, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    903
    Martin Honnen
    Nov 3, 2007
Loading...

Share This Page