这段代码:
string currentPrice = String.Format("{0:c}", ((TblProduct)e.ListItem).Price);
Run Code Online (Sandbox Code Playgroud)
以美元显示价格,即$320.00.但我想显示一个比索符号而不是一个美元符号.我应该使用什么system.string?{?:?}
您需要指定其他参数(格式提供程序)才能获取适当的货币符号和格式.例如,要格式化菲律宾:
var currentPrice = String.Format(CultureInfo.GetCultureInfo("en-PH"),
"{0:c}",
((TblProduct)e.ListItem).Price);
Run Code Online (Sandbox Code Playgroud)
如果未指定格式提供程序,CultureInfo.CurrentCulture则使用.
| 归档时间: |
|
| 查看次数: |
4337 次 |
| 最近记录: |