This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes string to int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "string to int" Watch "string to int" New topic
Author

string to int

Andrew Lit
Ranch Hand

Joined: Jul 01, 2002
Posts: 135
hi,
it is very urgent. i've forgotten method that converts string to int. plz remind me. would be very appreciated.
thanks
Igor Ko
Ranch Hand

Joined: Jun 24, 2002
Posts: 90
Integer.parseInt()
Volodymyr Shram
Ranch Hand

Joined: Oct 17, 2002
Posts: 47
Originally posted by Andrew Lit:
hi,
it is very urgent. i've forgotten method that converts string to int. plz remind me. would be very appreciated.
thanks

Wilfried LAURENT
Ranch Hand

Joined: Jul 13, 2001
Posts: 269
If performance is an issue, the first solution should be chosen.
W.
kumard
Greenhorn

Joined: Mar 06, 2001
Posts: 4
//-----------------------------
public void test1() {
String i = "5";
timer.reset();
for(int j = 0; j < loop; j++) {
int k = Integer.valueOf(i).intValue();
}
timer.print("intValue");
}
//-----------------------------
public void test2() {
String i = "5";
timer.reset();
for(int j = 0; j < loop; j++) {
int k = Integer.parseInt(i);
}
timer.print("parseInt");
}
my test shows
intValue: 173.5
parseInt: 121.9
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: string to int