这段代码:
string currentPrice = String.Format("{0:c}", ((TblProduct)e.ListItem).Price);
以美元表示价格,即$320.00
。但是我想显示一个比索符号而不是美元符号。我应该使用什么system.string?{?:?}
发布于 2013-07-04 11:46:44
您需要指定一个附加参数(格式提供程序),以便获取适当的货币符号和格式。例如,要为菲律宾设置格式:
var currentPrice = String.Format(CultureInfo.GetCultureInfo("en-PH"),
"{0:c}",
((TblProduct)e.ListItem).Price);
如果未指定格式提供程序,则使用CultureInfo.CurrentCulture
。
发布于 2015-06-16 22:58:09
试试看这个对我很管用。我正在使用Unicode字符转义序列,它是"\u“,然后是它的十六进制Unicode值。
Unicode Character 'PESO SIGN' (U+20B1)
string currentPrice = String.Format("\u20B1{0}", ((TblProduct)e.ListItem).Price);
https://stackoverflow.com/questions/17461443
复制相似问题