import org.junit.Test;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
public class Demo1 {
public static void main(String[] args) {
BigDecimal bd = new BigDecimal(123456789.345678+"%");
System.out.println(parseNumber(",###.###", bd)); // out: 123,456,789.30
}
@Test
public void test1(){
// System.out.println(chuliStr("123234565.1235", 3, ",###"));
// System.out.println(chuliStr("123234565.12", 3, ",###"));
// System.out.println(chuliStr("123234565.99999", 4, ",###"));
System.out.println(chuliStr("125.12336%", 4, ",###"));
// System.out.println(chuliStr("", 4, ",###"));
字符串 千分位分割 和 保留制定小数位
最新推荐文章于 2022-08-17 16:24:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)