List of utility methods to do Regex Double Validate
double | parseDouble(final String text) If the next token is a double and return its value. if (DOUBLE_INFINITY.matcher(text).matches()) { final boolean negative = text.startsWith("-"); return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY; if (text.equalsIgnoreCase("nan")) { return Double.NaN; final double result = Double.parseDouble(text); ... |
double | parseDouble(Object object) parse Double if (null == object) return 0.0; String str = object.toString(); if ("".equals(str)) return 0.0; str = getFirstMatcher(regexDouble, str); return Double.parseDouble(str); |
Double | parseDouble(Object value, Double replace) parse Double if (!isDigit(value)) { return replace; return new Double(value.toString()); |
Double | parseDouble(String myString) Check if a string can be parsed correctly. final String Digits = "(\\p{Digit}+)"; final String HexDigits = "(\\p{XDigit}+)"; final String Exp = "[eE][+-]?" + Digits; final String fpRegex = ("[\\x00-\\x20]*" + "[+-]?(" + "NaN|" + "Infinity|" + "(((" + Digits + "(\\.)?(" + Digits + "?)(" + Exp + ")?)|" + ... |
double | parseDouble(String s) Convert to a double value double rv = 0; if (s != null && s.trim().length() > 0) { try { rv = Double.parseDouble(s.trim()); } catch (NumberFormatException nfe) { boolean parsed = false; String trimmed = s.trim(); Matcher m1 = nf1.matcher(trimmed); ... |
double | parseDouble(String str) parse Double if (isBuggyDoubleString(str)) { throw new NumberFormatException("Buggy double string"); return Double.parseDouble(str); |
double[] | parseDoubleList(String list) Scans an input string for double values. if (list == null) return null; fpMatch.reset(list); LinkedList doubList = new LinkedList(); while (fpMatch.find()) { String val = fpMatch.group(1); doubList.add(Double.valueOf(val)); double[] retArr = new double[doubList.size()]; Iterator it = doubList.iterator(); int idx = 0; while (it.hasNext()) { retArr[idx++] = ((Double) it.next()).doubleValue(); return retArr; |