This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Formatting strings as money format  RSS feed

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • 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: 1511
  • 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
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try it this way:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!