Java Utililty Methods Regex Double Validate

List of utility methods to do Regex Double Validate

Description

The list of methods to do Regex Double Validate are organized into topic(s).

Method

doubleparseDouble(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);
...
doubleparseDouble(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);
DoubleparseDouble(Object value, Double replace)
parse Double
if (!isDigit(value)) {
    return replace;
return new Double(value.toString());
DoubleparseDouble(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 + ")?)|" +
...
doubleparseDouble(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);
...
doubleparseDouble(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;