參考 http://m955.com/wp/archives/176
http://www.dotblogs.com.tw/marcus116/archive/2012/03/11/70655.aspx
http://msdn.microsoft.com/zh-tw/library/0c899ak8(v=vs.80).aspx
Console.WriteLine(String.Format("{0:C}", 342523450.25)); //NT$342,523,450.25
Console.WriteLine(String.Format("{0:P}", 50.25)); //5,025.00%
Console.WriteLine(String.Format("{0:N}", 521361555.25)); //521,361,555.25
Console.WriteLine(String.Format("{0:00000.00000}", 125.125));//00125.12500 控制小數點到第三位 並且補零
Console.WriteLine(String.Format("{0:#####.###}", 12345.13425));//12345.134 控制小數點到第三位
Console.WriteLine(String.Format("{0:#,##0;0}", 12345.13425));//12,345
Console.WriteLine(String.Format("{0:#,0,,}", 1235742373345.13425)); //1,235,742 後面的"," 決定除以 1000
Console.WriteLine(String.Format("{0:(###) ### – ####}", 1235742373345.13425));//(123574) 237 – 3345
Console.WriteLine(String.Format("{0:(000) 000 – 0000.000;0}", 1235742373345.265155));//(123574) 237 – 3345.270
Console.WriteLine(String.Format("{0:$#,00;0}", 123423452345.13425));//$123,423,452,345
Console.WriteLine(String.Format("{0:00.0\n0000}", 52345.13425));//52345.1
//3425
//Console.WriteLine(String.Format("{0:00;0}",0.0));
0 意見:
張貼留言