Article View: borland.public.jbuilder.java.language
Article #14579help with columnar stdout printing?
From: jmurrayassoc
Date: Thu, 26 Aug 1999 00:00
Date: Thu, 26 Aug 1999 00:00
11 lines
1258 bytes
1258 bytes
I am converting a tried and true C program that I wrote too many years ago to Java, as a learning process. All has gone OK until I try to write a columnar output using system.out.print(). The output is dollars and percents and I want each column to align its decimal point. I convert my values, doubles with a little 'd', into NumberFormat and set my maximum and minimum fraction digits which always outputs two places and fixes the problem of trailing zero truncation, OK so far. The integer part of the numbers, though, vary in size and make the alignment wander because output is left justified. I tried setting minimum and maximum integer digits but that gets me leading zeros and I want leading spaces. If I only had sprintf()!
Technical Details
Message-ID:
<37C5A296.1AE63C83@concentric.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,711840d5cc340ef,start X-Google-Attributes: gidf74b3,public From: jmurrayassoc <murrayja@concentric.net> Subject: help with columnar stdout printing? Date: 1999/08/26 Message-ID: <37C5A296.1AE63C83@concentric.net> X-Deja-AN: 517574750 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language