Tuesday, February 15, 2011

Display Multiple Currency Symbols in C#

If you have a money amount:

decimal money = 107.04;

And know the code for a culture:

string cultureName = “en-gb”; // display currency in pounds

Create string containing a culture specific currency:

string formattedCurrency = String.Format(CultureInfo.CreateSpecificCulture(map[cur]), "{0:C}", decimal);

The table is on msdn: http://msdn.microsoft.com/en-us/library/ks7d2abt.aspx

Then you can insert that string into HTML (tested on IE 8):

image

No comments:

Post a Comment