如何更改格式货币'。'在asp.net MVC4中的',' 例如:10,000 thay cho 10.000 我有文件模板@ Model.ToString(“n0”)
答案 0 :(得分:0)
您可以使用允许指定区域性的ToString()重载。
// Use the culture you desire instead of en-US
culture = CultureInfo.CreateSpecificCulture("en-US");
Console.WriteLine(value.ToString(specifier, culture));
答案 1 :(得分:0)
看一下这个链接:
您可以通过指定数字格式和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
*/