首页 > 代码库 > C#格式化数值数据
C#格式化数值数据
static void Main(string[] args)
{
FormatNumber();
System.Console.ReadLine();
}
static void FormatNumber()
{
int value = http://www.mamicode.com/99999;
Console.WriteLine("The value " + value + " in various formats: ");
Console.WriteLine("c format: {0:c}",value);
Console.WriteLine("d9 format: {0:d9}", value);
Console.WriteLine("f3 format: {0:f3}", value);
Console.WriteLine("n format: {0:n}", value);
Console.WriteLine("E format: {0:E}", value);
Console.WriteLine("e format: {0:e}", value);
Console.WriteLine("X format: {0:X}", value);
Console.WriteLine("x format: {0:x}", value);
}
C#格式化数值数据