如何交换符号电流

时间:2013-07-03 07:41:12

标签: asp.net c#-4.0

如何更改格式货币'。'在asp.net MVC4中的',' 例如:10,000 thay cho 10.000 我有文件模板@ Model.ToString(“n0”)

2 个答案:

答案 0 :(得分:0)

您可以使用允许指定区域性的ToString()重载。

// Use the culture you desire instead of en-US
culture = CultureInfo.CreateSpecificCulture("en-US"); 
Console.WriteLine(value.ToString(specifier, culture));

http://msdn.microsoft.com/en-us/library/d8ztz0sa.aspx

答案 1 :(得分:0)

看一下这个链接:

http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.currencygroupseparator.aspx

您可以通过指定数字格式和CurrencyGroupSeparator

来修改示例代码和输出
using System;
using System.Globalization;

class NumberFormatInfoSample {

   public static void Main() {

      // Gets a NumberFormatInfo associated with the en-US culture.
      NumberFormatInfo nfi = new CultureInfo( "en-US", false ).NumberFormat;

      // Displays a value with the default separator (",").
      Int64 myInt = 123456789;
      Console.WriteLine( myInt.ToString( "N0", nfi ) );

      // Displays the same value with a specified separator.
      nfi.CurrencyGroupSeparator = ".";
      Console.WriteLine( myInt.ToString( "N0", nfi ) );

   }
}


/* 
This code produces the following output.

123,456,789
123.456.789
*/