public BigDecimal readStrAsBigDecimalAndCheckFormat(String str) {
DecimalFormat format = new DecimalFormat();
format.setParseBigDecimal(true);
ParsePosition position = new ParsePosition(0);
BigDecimal parse = (BigDecimal) format.parse(str, position);
if (str.length() == position.getIndex()) {
return parse;
}
return null;
}
带逗号的数值字符串转BigDecimal
最新推荐文章于 2021-08-26 10:00:29 发布