wood burning stoves*
The moose likes Java in General and the fly likes Change a String to an int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Change a String to an int" Watch "Change a String to an int" New topic

Change a String to an int

matt prowell

Joined: Jul 12, 2004
Posts: 18
I need to take a String and make it an int. Thanks for any help!
luc comeau
Ranch Hand

Joined: Jan 20, 2005
Posts: 97
This is probably a dirty way to do it, but yah...it works

Pretty sure that works, dunno how efficient or what not it is....
good luck

National Research Council<br />Internet Logic Department
luc comeau
Ranch Hand

Joined: Jan 20, 2005
Posts: 97
im a retard its suposed to be ----theInt=Integer.parseInt(theString);----
my bad
Lionel Badiou
Ranch Hand

Joined: Jan 06, 2005
Posts: 140
Hello Matt,

Look at the java.lang.Number.Integer.parseInt(String) method.

Hope that helps,

Lionel Badiou
CodeFutures Software
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299

Not about GUI stuff, moving to Java in General (Intermediate)

GenRocket - Experts at Building Test Data
It is sorta covered in the JavaRanch Style Guide.
subject: Change a String to an int
Similar Threads
How to deserialize persistent object if class has changed
Can I use the paramProperty from a hyperlink in a textfield in the called .jsp-page?
how many objects will be created.
how to subtract two strings
how to read speific lines in a text file