public static int toInteger ( String s ) { try { return Integer . parseInt ( s ) ; } catch ( NumberFormatException e ) { // Exception noted so can be ignored. e = null ; return 0 ; } }
Converts a string to an integer . The string must be a valid integer or the result will be zero .