Hi, Nik,

If you find DecimalFormat to powerfull for what you need, you can do it
yourself :

        float number = <a float number>;
        String unFormattedNumber = Float.toString(number) + "00";
        String formattedNumber = unFormattedNumber.substring(0,
unFormattedNumber.indexOf(".") + 3);

Pierre-Yves

-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[EMAIL PROTECTED]]De la part de Jozef
Chocholacek
Envoyé : lundi 7 mai 2001 15:34
A : [EMAIL PROTECTED]
Objet : Re: Question??


Nik DAMPIER wrote:

> How do I format a float to 2 decimal places to represent a price??

   See java.text.DecimalFormat and its documentation.

J.Ch.
--
Ing. Jozef Chocholacek                  Qbizm Technologies, Inc.
Chief Project Analyst                   ... the art of internet.
________________________________________________________________
Kralovopolska 139                          tel: +420 5 4124 2414
601 12 Brno, CZ      http://www.qbizm.com  fax: +420 5 4121 2696

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to