Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to convert a double into a currency string

1 view
Skip to first unread message

Chris Baker

unread,
Sep 21, 2003, 4:23:41 PM9/21/03
to
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)


VisionSet

unread,
Sep 21, 2003, 4:43:22 PM9/21/03
to

"Chris Baker" <bakermc(at)muohio.edu> wrote in message
news:3f6e0...@athenanews.com...

> 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


Roedy Green

unread,
Sep 21, 2003, 9:15:17 PM9/21/03
to
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.

0 new messages