Re: Java Newb
From: Denz (RUBBISH_at_RUBBISHhotmail.com)
Date: 01/25/04
- Next message: Konrad Den Ende: "Re: Strange behavior of a java.util.Vector"
- Previous message: Konrad Den Ende: "Re: Strange behavior of a java.util.Vector"
- In reply to: Robert Tyrie: "Re: Java Newb"
- Next in thread: hiwa: "Re: Java Newb"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 25 Jan 2004 22:34:10 GMT
"Robert Tyrie" <robtyrie@yahoo.ca> wrote in message
news:opr2berkd4shq0lc@news.cogeco.ca...
> On Sat, 24 Jan 2004 21:40:43 -0500, Travis Ray <travrichard@comcast.net>
> wrote:
>
> > Or is there a way to align columns other than putting spacer
> > strings inbetween data elements?
>
> Take a look at the DecimalFormat class,
>
> http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
As an *exercise*, might also want to do the formatting manually?
... by using String .indexOf('.') and .length() methods to determine how
many charaters after the decimal point, then add the append the appropriate
number of zeros to give you two decimal places. For alligning columns,
probably need to use .length() on individual strings to determine how many
spaces to use in padding to get column alignment.
- Next message: Konrad Den Ende: "Re: Strange behavior of a java.util.Vector"
- Previous message: Konrad Den Ende: "Re: Strange behavior of a java.util.Vector"
- In reply to: Robert Tyrie: "Re: Java Newb"
- Next in thread: hiwa: "Re: Java Newb"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|