wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Formatted output - any ideas? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Formatted output - any ideas?" Watch "Formatted output - any ideas?" New topic
Author

Formatted output - any ideas?

Richard Chambers
Ranch Hand

Joined: Apr 03, 2008
Posts: 40
I'm not getting my expected output here.

I'm reading a CSV file for values

it's returning dollar amounts

I sum all the amounts after all the records are read

I've got all the programming down OK for the whole program

but the column is not getting my desired output

I'm wanting to output this format:

$999,999.99

I'm using this:



the problem is that my output staggers by one space

$999,999.99
$999,999.99
$999,999.99
$999,999.99


Thanks
Richard Chambers
Ranch Hand

Joined: Apr 03, 2008
Posts: 40
OK, I answered my own question

never fails, I struggle for hours, and
minutes after posting the solution hits me

it's only 8 digits, the comma and . don't count

8.2 instead of 10.2 makes it come out right

Thanks everyone
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Formatted output - any ideas?
 
Similar Threads
Validation error / unknown cause
DecimalFormat drops trailing zero
line return in drawString()
problem in output format
Happy Groundhog day........