NumberChineseFormatter提供阿拉伯转中文支持多位小数的方法

This commit is contained in:
Looly
2024-04-21 08:12:07 +08:00
parent 8279681651
commit c02460423e
3 changed files with 12 additions and 1 deletions

View File

@@ -3,6 +3,8 @@ package cn.hutool.core.convert;
import org.junit.Assert;
import org.junit.Test;
import java.math.BigDecimal;
public class NumberChineseFormatterTest {
@Test
@@ -342,4 +344,10 @@ public class NumberChineseFormatterTest {
format = NumberChineseFormatter.format(1.02, false, false);
Assert.assertEquals("一点零二", format);
}
@Test
public void dotTest() {
final String format = NumberChineseFormatter.format(new BigDecimal("3.1415926"), false, false);
Assert.assertEquals("三点一四一五九二六", format);
}
}