File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Formatting strings as money format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Formatting strings as money format" Watch "Formatting strings as money format" New topic

Formatting strings as money format

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

I have strings read from the database in decimal format
which I want to format as money e.g. 48.00
There must be some class that does this in Java 1.2 ?


Bosun Bello
Ranch Hand

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

So much trouble in the world -- Bob Marley
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Hi Bosun,
I tried to write a simple program using NumberFormat like this:

But I continually get a ParseException. What goes ?
Cindy Glass
"The Hood"

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:
subject: Formatting strings as money format
Similar Threads
Why my code get error ?
connecting MIDlet to database?
Way to export data to PDF,Ms Money and Quicken Format
phone number formatter in struts2
Need to parse StringBuffer