static Integer integer ( String value ) { Integer result ; if ( value != null ) { value = value . trim ( ) ; Matcher matcher = INTEGER_PATTERN . matcher ( value ) ; if ( matcher . matches ( ) ) { result = Integer . parseInt ( matcher . group ( 1 ) . replace ( " " , "" ) ) ; } else { throw new IllegalArgumentException ( "Unknown format for value: " + value ) ; } } else { result = null ; } return result ; }
Convert a string to an integer .