Csharp/C Sharp/Development Class/NumberFormatInfo
Версия от 15:31, 26 мая 2010; (обсуждение)
Set NumberGroupSeparator
using System.Globalization;
using System;
public class MainClass {
public static void Main() {
NumberFormatInfo f = new NumberFormatInfo();
f.NumberGroupSeparator = " ";
Console.WriteLine(12345.6789.ToString("N3", f)); // 12 345.679
}
}
Use NumberFormatInfo to format a number
using System;
using System.Globalization;
public class MainClass {
public static void Main() {
NumberFormatInfo f = new NumberFormatInfo();
f.CurrencySymbol = "$$";
Console.WriteLine(3.ToString("C", f)); // $$ 3.00
}
}