me.excel.tools.validator.cell.DoubleValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-excel-tools Show documentation
Show all versions of java-excel-tools Show documentation
powerful and convenient excel tools
The newest version!
package me.excel.tools.validator.cell;
import me.excel.tools.model.excel.ExcelCell;
/**
* double validator
*
* Created by hanwen on 15-12-16.
*/
public class DoubleValidator extends CellValidatorAdapter {
public DoubleValidator(String matchField) {
super(matchField, "应该为小数");
}
public DoubleValidator(String matchField, String errorMessage) {
super(matchField, errorMessage);
}
@Override
protected boolean customValidate(ExcelCell excelCell) {
try {
Double.parseDouble(excelCell.getValue());
} catch (NumberFormatException e) {
return false;
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy