Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert a string to an integer?

Status
Not open for further replies.

Petal

Programmer
Jun 8, 2001
56
NO
I would like to convert this string: req.getParameter("officecode"); to integer.
Can I do it something like this:
officecode = toInteger( req.getParameter("officecode"));
 
Hi,

This is what you can do:-

int officeCode = Integer.parseInt(req.getParameter("officecode"));

Your above codes will not work unless you have a method toInteger that accepts a String as an input and returns a int value and within the method, you convert the String to an int value. Remember when you do something like abc(), this means that you are calling the method abc().

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top