File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Formatting strings as money format Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Formatting strings as money format" Watch "Formatting strings as money format" New topic
Author

Formatting strings as money format

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 757

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


Regards,

Pho
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
Check out the DecimalFormat class in the java.text package.
Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 757

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

Joined: Sep 29, 2000
Posts: 8521
Try it this way:


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Formatting strings as money format
 
Similar Threads
Way to export data to PDF,Ms Money and Quicken Format
phone number formatter in struts2
connecting MIDlet to database?
Why my code get error ?
Need to parse StringBuffer