格式化输出数字

$a = 348
 
"{0:N2}" -f $a
"{0:D8}" -f $a
"{0:C2}" -f $a
"{0:P0}" -f $a
"{0:X0}" -f $a
 
348.00
00000348
¥348.00
34,800%
15C
 
 

参考:

https://msdn.microsoft.com/zh-cn/library/dwhawy9k(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#DFormatString

https://technet.microsoft.com/en-us/library/ee692795.aspx

http://www.pstips.net/formatting-string.html

http://www.pstips.net/formatting-numbers-easily.html
posted @ 2015-05-10 20:37  dongdonggeorge  阅读(201)  评论(0编辑  收藏  举报