<td>¥
<apex:outputText value="{0,Number,,000.00}">
<apex:param value="{!sd.Total_Price__c}"/>
</apex:outputText>
</td>
<apex:outputText value="{0,number,currency}">
自带美元符号或者
(Apex Class 中的方法):
private string ConvertToMoneyFormat(decimal price){
if (price == null || Math.abs(price) < 0.005) return '$0.00';
String s = (price.setScale(2) + (price >= 0 ? 0.001 : -0.001)).format();
return '$' + s.substring(0, s.length() - 1);
}基本结果表现为:11 ----> $11.00
1111 ---> $1,111.00
1111.1 ---> $1,111.10
1111.111 ---> $1,111.11
本文介绍如何使用 Apex 代码进行数字和货币格式化,包括直接在页面中使用 Apex 标签进行格式化以及通过 Apex 类的方法实现自定义的货币格式化。
10

被折叠的 条评论
为什么被折叠?



