其他分享
首页 > 其他分享> > 判断字符串是否可以转成BigDecimal(可转用小数,负数)

判断字符串是否可以转成BigDecimal(可转用小数,负数)

作者:互联网

/**
* 判断字符串是否可以转成BigDecimal(可转用小数,负数)
*
* @param strNum
* @return
*/
public static boolean isDigit(String strNum) {
if (StringUtils.isBlank(strNum)) {
return false;
}
Pattern pattern = Pattern.compile("-?[0-9]+(\\.[0-9]+)?");
Matcher matcher = pattern.matcher(strNum);
return matcher.matches();
}

标签:return,BigDecimal,matcher,转用,pattern,Pattern,strNum,小数
来源: https://www.cnblogs.com/isalo/p/16378447.html