【发布时间】:2023-03-28 02:48:01
【问题描述】:
我正在检索以下十进制值,需要将这些值转换为字符串。
// 百分比列
column1: 获取值为 0.08,应在 UI 中显示为 8.00%
// 货币列
Column2:获取值为 1000 的值应在 UI 中显示为 $1000
column3:获取值为 3000 的值应在 UI 中显示为 $3000
有可能做这样的事情吗?
String PercentageCustomFormat="{PercentageCustomFormat}";
string CurrencyCustomFormat="{CurrencyCustomFormat}";
PercentageCustomFormat/ CurrencyCustomFormat 应包含如果任何列返回 Null,则应显示为“NA”的逻辑。
检索:
String.Format("{PercentageCustomFormat}", column1);
String.Format("{CurrencyCustomFormat}", column2);
提前致谢
【问题讨论】:
-
msdn 上的这个 url 应该可以帮助msdn.microsoft.com/en-us/library/dwhawy9k.aspx
标签: asp.net .net visual-studio-2010 c#-4.0