Trim 结尾的 0 后输出 String
This commit is contained in:
parent
75f5523a93
commit
3073a3e5db
|
@ -193,4 +193,17 @@ public class BigDecimalDemoUnitTest {
|
|||
logger.info("{}", bigNumber.toEngineeringString());
|
||||
logger.info("{}", bigNumber.toPlainString());
|
||||
}
|
||||
|
||||
/**
|
||||
* To StripTrailingZeros
|
||||
*/
|
||||
@Test
|
||||
public void bigDecimalStripTrailingZerosTest() {
|
||||
BigDecimal bigNumber = new BigDecimal("2707000000000");
|
||||
|
||||
// apply StripTrailingZeros function
|
||||
logger.info("{}", bigNumber.toString());
|
||||
logger.info("{}", bigNumber.stripTrailingZeros().toString());
|
||||
logger.info("{}", bigNumber.stripTrailingZeros().toPlainString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue