public static Number parseNumber ( String numberAsString ) throws InvalidSelectorException { if ( numberAsString == null ) return null ; try { if ( numberAsString . indexOf ( ' ' ) != - 1 || numberAsString . indexOf ( ' ' ) != - 1 || numberAsString . indexOf ( ' ' ) != - 1 ) { return new Double ( numberAsString ) ; } else return Long . valueOf ( numberAsString ) ; } catch ( NumberFormatException e ) { throw new InvalidSelectorException ( "Invalid numeric value : " + numberAsString ) ; } }
Parse a number as string