This commit is contained in:
Looly 2021-09-17 21:15:04 +08:00
parent 9db1d175e0
commit 59be04e0a5
2 changed files with 9 additions and 1 deletions

View File

@ -2501,7 +2501,8 @@ public class NumberUtil {
}
/**
* 将指定字符串转换为{@link Number} 对象
* 将指定字符串转换为{@link Number} 对象<br>
* 此方法不支持科学计数法
*
* @param numberStr Number字符串
* @return Number对象

View File

@ -393,4 +393,11 @@ public class NumberUtilTest {
final Set<?> set = Convert.convert(Set.class, ints);
Assert.assertEquals(7, set.size());
}
@Test
public void toPlainNumberTest(){
String num = "5344.34234e3";
final String s = new BigDecimal(num).toPlainString();
Assert.assertEquals("5344342.34", s);
}
}