c# - C# 中的 EGP 货币

标签 c# visual-studio console-application

如何使 int 变量在控制台应用程序中显示为货币。从 EGP 开始。我尝试了以下代码,但它只将阿拉伯语显示为“ì.م”,而不是 EGP。

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

但结果是:?.?.? 12.5 而不是“EGP”,因为它是阿拉伯语。我需要的是使其成为 EGP 12.5 而不是“ì.م”

enter image description here

最佳答案

EGP 是 ISOCurrencySymbol埃及镑。

这应该适合你。

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);
   }
}

关于c# - C# 中的 EGP 货币,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35062968/

相关文章:

c# - 如何向上导航几个文件夹?

c# - Parallel.For 和 For 产生不同的结果

c# - 服务器标记格式不正确 - 超链接数据绑定(bind)

c# - 绑定(bind)到 MainView 窗口的 Width 属性时出现绑定(bind)错误

python - Visual Studio 2019、Python 和 Neuron 模拟器

Python 将连字符附加到 API 的日期输出

python - 从子进程启动时如何停止 Bottle Web 服务器

c# - 抑制 Console.Write 在引用包中

c# - 为什么 myString.IsNullOrEmpty() 没有内置到 .Net 中?

javascript - 在 C++ 中将 ostream 分配给数据类型字符串