Article View: borland.public.jbuilder.java.language
Article #16468Re: String formatting doubles & floats
From: Tor Iver Wilhelmsen
Date: Thu, 25 Feb 1999 00:00
Date: Thu, 25 Feb 1999 00:00
10 lines
765 bytes
765 bytes
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:
<uogmiuaaf.fsf@sds.no>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36D47CA1.C8AC18BC@netvendor.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,cc1b010f2fed51be X-Google-Attributes: gidf74b3,public From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no> Subject: Re: String formatting doubles & floats Date: 1999/02/25 Message-ID: <uogmiuaaf.fsf@sds.no> X-Deja-AN: 448241197 Sender: towi@SDSA1761 References: <36D47CA1.C8AC18BC@netvendor.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language