Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

java turn string into int

//parsing string to int
String numberToParse = "420";
int number = 0;

try{
  	number = Integer.parseInt(numberToParse);
}catch(NumberFormatException e){
	//the string cannot be parsed into a number
  	//ex Integer.parseInt("d15");
  	e.printStackTrace();
}

System.out.println(number);
Source by mkyong.com #
 
PREVIOUS NEXT
Tagged: #java #turn #string #int
ADD COMMENT
Topic
Name
4+3 =