Baig's response is correct although it will return the Object value Float.
If you want a basic data type float, which may be easier to work with, use:

        float variable = Float.parseFloat(request.getParemeter("anotherVariable"));

        You can find this all in the JDK API under the Float object spec.

        Matt Penner

 -----Original Message-----
From:   A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]  On Behalf Of Imran
Baig
Sent:   Monday, December 25, 2000 10:14 PM
To:     [EMAIL PROTECTED]
Subject:        Re: Casting

use Float.valueOf("Your String")

Baig





Hamid Farooqui <[EMAIL PROTECTED]> on 12/25/2000 01:22:32 PM

Please respond to "A mailing list for discussion about Sun Microsystem's
Java
      Servlet API Technology." <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Imran Baig/CresSoft)

Subject:  Casting



Hi all

I understand that what we get by
variable = request.getParemeter("anotherVariable")
is always a string

I need to use the variable in some calculations and need this as a float
But it seems casting doesnt work in servlet

Anybody has any idea as to how to convert this to a float

TIA

Hamid

___________________________________________________________________________
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

___________________________________________________________________________
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