How do I display Nigerian Naira symbol in CultureInfo(c#)

c# cultureinfo

2099 просмотра

2 ответа

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

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 />

Any ideas how to achieve it?

Автор: sirbombay Источник Размещён: 13.11.2019 11:33

Ответы (2)


3 плюса

Решение

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 = "₦";

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).

Автор: Jon Размещён: 10.09.2013 10:44

0 плюса

It looks like the symbol used in the CultureInfo is just an "N". To view the proper version, you can use this shortcut.

char x = (char)8358;
MessageBox.Show(x.ToString());
Автор: Sean Kornish Размещён: 10.09.2013 10:45
Вопросы из категории :
32x32