static BigDecimal decimal ( String value ) { BigDecimal result ; if ( value != null ) { value = value . trim ( ) ; Matcher matcher = DECIMAL_PATTERN . matcher ( value ) ; if ( matcher . matches ( ) ) { result = new BigDecimal ( matcher . group ( 1 ) ) ; } else { throw new IllegalArgumentException ( "Unknown format for value: " + value ) ; } } else { result = null ; } return result ; }
Convert a string to a big decimal .