首页 > 其他 > 详细

freemarker常用值格式化方法

时间:2016-06-07 14:54:24      阅读:147      评论:0      收藏:0      [点我收藏+]

  freemarker常用的值格式化方法:

1、${price?string(‘0.00‘)}

对price进行格式化,小数点后不足2位用0补足。

比如:price=1

输出:1.00

 

2、${price?string(‘#.##‘)}

对price进行格式化,小数点后多余2位只保留2位,少于2位显示实际位数。

比如:price=1.234

输出:1.23

 

3、${price?string.currency}

对price进行格式化,显示为货币格式。

比如:price=1

输出:¥1.00

 

4、${price?string.percent}

对price进行格式化,显示为百分比。

比如:price=1

输出:100%

 

freemarker常用值格式化方法

原文:http://www.cnblogs.com/pcheng/p/5566773.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!