Here you can find the source of convertStringToInt(final String str)
Parameter | Description |
---|---|
str | the string to convert |
private static int convertStringToInt(final String str)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w . j a v a 2s . c o m * Convert the specified string into an integer. * * @param str the string to convert * @return the integer value for the string */ private static int convertStringToInt(final String str) { int val = -1; try { val = Integer.parseInt(str); } catch (NumberFormatException nfe) { val = -1; } return val; } }