Tuesday, May 22, 2012

Convert String to int

What is the best way to convert the String Object that represents a int value to the primitive type int? Just follow this suggestion, that takes advantage of the parseInt method of the Integer object:

String strValue = "1";
int intValue = Integer.parseInt(strValue);

1 comment: