How to convert a double into a currency string

C

Chris Baker

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!
 
V

VisionSet

Chris Baker said:
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));
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top