本文介绍了如何在CultureInfo(c#)中显示尼日利亚奈拉符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示一个带有尼日利亚货币符号的金额(即N,通过 双击)。

I want to display an amount with the Nigerian currency symbol (i.e N with double strike through "").

我尝试了一段ff代码,仅显示金额为N而不显示正确的符号(N通过两次删除)

I've tried the ff piece of code which only displays the amount with just N and not with the properly symbol(N with double strike through )

@{ IFormatProvider currencyFormat = new System.Globalization.CultureInfo("HA-LATN-NG"); }

Amount: @string.Format(currencyFormat, "{0:c}", Model.Amount) <br />

任何想法如何实现?

推荐答案

似乎内置的尼日利亚文化具有纯正的英语 N 作为其货币符号。您可以改用:

It looks like the built-in nigerian cultures have a straight english N as their currency symbol. You can override that to use the Naira sign instead:

var formatter = new System.Globalization.CultureInfo("HA-LATN-NG");
formatter.NumberFormat.CurrencySymbol = "₦";

在此之后,将全部使用 formatter 进行格式化所需的符号,但请注意,该字符还通过网站呈现的字体显示。某些字体可能不包含该符号,或者它们可能在其位置包含一个不同的符号(我在本地计算机上看到了此符号)。

After this all formatting with formatter will use the desired symbol, but be aware that the character also needs to be supported by the font the website renders in. Some fonts may not include the symbol or they might include a different symbol in its place (I have seen this on my local machine).

这篇关于如何在CultureInfo(c#)中显示尼日利亚奈拉符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 23:29