Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Currency format for display

Is there a way to format the correct currency representation for a country?

Example UK -£127.54 Netherlands € 127,54- USA $127.54

etc..

Some things to consider,

  1. Currency Symbol

  2. Currency symbol placement -- It can be either place before or after the digits.

  3. Negative-amount display

like image 997
001 Avatar asked Jan 30 '11 10:01

001


People also ask

How do you display currency format?

Tip: You can also press Ctrl+1 to open the Format Cells dialog box. In the Format Cells dialog box, in the Category list, click Currency or Accounting. In the Symbol box, click the currency symbol that you want. Note: If you want to display a monetary value without a currency symbol, you can click None.

What is the correct way to write currency?

For US dollars, the symbol '$' is sufficient abbreviation, unless there is a mixture of dollar currencies in the text. For other dollar currencies, '$' should be prefixed with the country abbreviation. For all other currencies, write the figure first followed by the currency name, for example, '100 million yuan'.

What is a currency template?

The currency template is used for importing new and updated organization-level currency table information into the application. This template is divided into the following two sections: Currency Table Detail Section. Currency Table Header Section.

How would you display currency and currency symbol of a country?

Display Currency symbol to the right using Angular Currency Pipe. A lot of european countries use the currency symbol at the right side of currency value (France, Germany, Spain, Italy countries).


1 Answers

Try the Currency Format Specifier ("C"). It automatically takes the current UI culture into account and displays currency values accordingly.

You can use it with either String.Format or the overloaded ToString method for a numeric type.

For example:

decimal value = 12345.6789M; // Be sure to use Decimal for money values. Do not use IEEE-754 types such as float (System.Single) and double (System.Double) as they can only store approximate values. Console.WriteLine(value.ToString("C", CultureInfo.CurrentCulture));  Console.WriteLine(value.ToString("C3", CultureInfo.CurrentCulture));  Console.WriteLine(value.ToString("C3", CultureInfo.CreateSpecificCulture("da-DK")));  // The example displays the following output on a system whose // current culture is English (United States): //       $12,345.68 //       $12,345.679 //       kr 12.345,679 
like image 178
Cody Gray Avatar answered Oct 23 '22 18:10

Cody Gray