Article View: borland.public.jbuilder.java.language
Article #16392Re: String formatting doubles & floats
From: John Propper
Date: Thu, 25 Feb 1999 00:00
Date: Thu, 25 Feb 1999 00:00
16 lines
957 bytes
957 bytes
Thanks!
-- john
Tor Iver Wilhelmsen wrote:
> John Propper <jpropper@netvendor.com> writes:
>
> > For example, how can I format a float of 123.4 so that it's string
> > representation is "123.40".
>
> Look at java.text.DecimalFormat:
>
> DecimalFormat fmt = new DecimalFormat("#.00");
> String s = fmt.format(123.4);
> // produces "123.40" in s
Technical Details
Message-ID:
<36D5C704.AC18C3B@netvendor.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36D47CA1.C8AC18BC@netvendor.com> <uogmiuaaf.fsf@sds.no>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,cc1b010f2fed51be X-Google-Attributes: gidf74b3,public From: John Propper <jpropper@netvendor.com> Subject: Re: String formatting doubles & floats Date: 1999/02/25 Message-ID: <36D5C704.AC18C3B@netvendor.com> X-Deja-AN: 448468520 Content-Transfer-Encoding: 7bit References: <36D47CA1.C8AC18BC@netvendor.com> <uogmiuaaf.fsf@sds.no> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language