3

How to make an int variable show as currency in console app. Begin with EGP. I tried the following code, but it only shows the Arabic as "ج.م", not EGP.

 double x = 12.5;
    Console.WriteLine(x.ToString("C",CultureInfo.CreateSpecificCulture("ar-EG")));

But the result is: ?.?.? 12.5 instead of "EGP" because it is in Arabic language. What I need is to make it EGP 12.5 not "ج.م"

enter image description here

René Vogt
  • 43,056
  • 14
  • 77
  • 99
kareem.khalil
  • 141
  • 1
  • 11
  • Take a look to this question: http://stackoverflow.com/questions/5750203/how-to-write-unicode-chars-to-console It's about displaying unicode characters in the console. – ADreNaLiNe-DJ Jan 28 '16 at 13:38
  • @ADreNaLiNe-DJ but he doesn't *want* to display unicode characters in the console: 'What I need is to make it EGP 12.5 not "ج.م"' – AakashM Jan 28 '16 at 14:24

1 Answers1

4

EGP is the ISOCurrencySymbol for Egyptian Pound.

This should work for you.

using System;
using System.Globalization;
public class PrintCurrencyValue  {
   public static void Main()  {
      double x = 12.5;
      RegionInfo myRI1 = new RegionInfo( "ar-EG" );
      Console.WriteLine( "CurrencySymbol:    {0} {1:N}", myRI1.CurrencySymbol, x);
      Console.WriteLine( "ISOCurrencySymbol: {0} {1:N}", myRI1.ISOCurrencySymbol, x);
   }
}
CS.
  • 766
  • 8
  • 24