• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Formatting strings as money format

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have strings read from the database in decimal format
e.g.
48.0
which I want to format as money e.g. 48.00
There must be some class that does this in Java 1.2 ?
Thanks
Pho
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the DecimalFormat class in the java.text package.
Bosun
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bosun,
I tried to write a simple program using NumberFormat like this:

But I continually get a ParseException. What goes ?
Thanks
Pho
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try it this way:
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic