2018-05-11 02:11:33 +05:30
|
|
|
package com.baeldung.stringisnumeric;
|
|
|
|
|
|
2018-05-12 01:27:49 +03:00
|
|
|
import org.apache.log4j.Logger;
|
2018-05-11 02:11:33 +05:30
|
|
|
|
|
|
|
|
public class IsNumericDriver {
|
|
|
|
|
private static IsNumeric isNumeric;
|
2018-05-12 01:27:49 +03:00
|
|
|
private static Logger LOG = Logger.getLogger(IsNumericDriver.class);
|
2018-05-11 02:11:33 +05:30
|
|
|
static {
|
|
|
|
|
isNumeric =new IsNumeric();
|
2018-05-12 01:27:49 +03:00
|
|
|
|
2018-05-11 02:11:33 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
LOG.info("Testing all methods...");
|
|
|
|
|
|
|
|
|
|
boolean res = isNumeric.usingCoreJava("1001");
|
|
|
|
|
LOG.info("Using Core Java : " + res);
|
|
|
|
|
|
|
|
|
|
res = isNumeric.usingRegularExpressions("1001");
|
|
|
|
|
LOG.info("Using Regular Expressions : " + res);
|
|
|
|
|
|
|
|
|
|
res =isNumeric.usingNumberUtils_isCreatable("1001");
|
|
|
|
|
LOG.info("Using NumberUtils.isCreatable : " + res);
|
|
|
|
|
|
|
|
|
|
res =isNumeric.usingNumberUtils_isParsable("1001");
|
|
|
|
|
LOG.info("Using NumberUtils.isParsable : " + res);
|
|
|
|
|
|
|
|
|
|
res =isNumeric.usingStringUtils_isNumeric("1001");
|
|
|
|
|
LOG.info("Using StringUtils.isNumeric : " + res);
|
|
|
|
|
|
|
|
|
|
res =isNumeric.usingStringUtils_isNumericSpace("1001");
|
|
|
|
|
LOG.info("Using StringUtils.isNumericSpace : " + res);
|
|
|
|
|
}
|
|
|
|
|
}
|