Checking whether the string is a purely digital
Checking whether the string is a number
Such as the title of the article, as follows:
/**
* 校验字符串是否是纯数字
*
* @param str 数字字符串
* @return boolean
*/
private static boolean isInteger(String str) {
String s = "^[-+]?[\\d]*$";
Pattern pattern = Pattern.compile(s);
return pattern.matcher(str).matches();
}