new DecimalFormat("0.##")与new DecimalFormat("0.00")的区别
区别 quot New
2023-09-14 09:02:30 时间
#与0的区别:
#:没有则为空
0:没有则补0
final DecimalFormat df = new DecimalFormat("0.##");
final String str1 = df.format(a);
final DecimalFormat df = new DecimalFormat("0.00");
final String str1 = df.format(a);
执行结果:
3.1
3.10
参考:new DecimalFormat("0.##")与new DecimalFormat("0.00")的区别
相关文章
- 企业Linux与Unix的区别
- C#构造函数里的base和this的区别
- offsetTop,offsetHeight,clientHeight,scrollHeight,scrollTop区别
- Java中环境变量PATH与CLASSPATH的区别
- 浅谈java中"&&"和"&"的区别
- 数组与对象的区别
- POST和GET区别
- mysql中" ' "和 " ` "的区别
- lindo与lingo软件有什么区别?
- iOS(swift)结构体(struct)和类(class)的区别 单例
- @NotEmpty、@NotBlank等注解的正确使用 @Validated和@Valid的区别 解决@NotBlank等注解不生效的问题 使用BindingResult进行接口请求参数的统一校验
- python 进程、线程、协程之间的区别
- apt指令的autoclean,clean,autoremove的区别
- String str=new String("a")和String str = "a"有什么区别?
- padding valid same区别——就是是否补齐0的问题
- DNS SOA NS区别
- #include ““和#include <>区别
- nvarchar和varchar的区别
- C 中 i++ 与 ++i 有什么区别