Article View: borland.public.jbuilder.java.language
Article #14401Re: How do I format my double as a string?
From: Ken Sprague
Date: Fri, 03 Sep 1999 00:00
Date: Fri, 03 Sep 1999 00:00
40 lines
1554 bytes
1554 bytes
Bob, The java.text.NumberFormat and java.text.DecimalFormat classes have precise control over formatting numbers, but they don't do exponential formatting. The java.lang.Double.toString() method does scientific notation, but doesn't have precise control over the format of the number. The only solution I'm aware of is the ExponentialFormat class written by Elliotte Harold in his book "Java I/O", published by O'Reilly. Hope this helps. Ken Ramdrive <bob_kuhar@ccmail.sgo.sony.com.SPAM_ME_NOT> wrote in message news:7qopfp$i7s15@forums.borland.com... > What I've got is a double. What I want is its value formatted as a string > of the type > > 99999E99 > or > -99999E-99 > or > 99999E-99 > or > -99999E99 > as appropriate. > > get the picture? How is this accomplished in Java. Oh how I long for > sprintf()! > > Thanks in advance. > > Bob > > >
Technical Details
Message-ID:
<7qrftt$lac2@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7qopfp$i7s15@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,f561c0d27fc99a5f X-Google-Attributes: gidf74b3,public From: "Ken Sprague" <ksprague@email.msn.com> Subject: Re: How do I format my double as a string? Date: 1999/09/03 Message-ID: <7qrftt$lac2@forums.borland.com> X-Deja-AN: 521036619 Content-Transfer-Encoding: 7bit References: <7qopfp$i7s15@forums.borland.com> Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal X-Priority: 3 Content-Type: text/plain; charset="iso-8859-1" Mime-Version: 1.0 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Newsgroups: borland.public.jbuilder.java.language