对比索标志的美元的符号

时间:2013-07-04 03:35:53

标签: c# visual-studio-2010

此代码:

string currentPrice = String.Format("{0:c}", ((TblProduct)e.ListItem).Price);

以美元显示价格,即$320.00。但我想显示一个比索符号而不是一个美元符号。我应该使用什么system.string? {?:?}

2 个答案:

答案 0 :(得分:6)

您需要指定其他参数(格式提供程序)才能获取相应的货币符号和格式。例如,要格式化菲律宾:

var currentPrice = String.Format(CultureInfo.GetCultureInfo("en-PH"),
                                 "{0:c}",
                                 ((TblProduct)e.ListItem).Price);

如果未指定格式提供程序,则使用CultureInfo.CurrentCulture

答案 1 :(得分:1)

试试这个适合我。 即时通讯使用Unicode字符转义序列,它是" \ u"然后是其十六进制的unicode值。

Unicode Character 'PESO SIGN' (U+20B1)

string currentPrice = String.Format("\u20B1{0}", ((TblProduct)e.ListItem).Price);