- -f 與.NET中的System.String中的Format方法相同
PS C:\> [string]::Format('{2},{1},{0}',1,2,3)
3,2,1
PS C:\> '{2},{1},{0}' -f 1,2,3
3,2,1 - 語法如下:
- {<index>[,<alignment>][:<formatString>]}
- 例如:'|{0,6:d5}|' -f 123
- 結果
- | 00123|
- 解釋
- 0代表-f後所接的第一個參數
- 6代表長度為6,且資料靠右
- d5代表資料為數字格示,且不滿五位數用0填滿
全站熱搜
留言列表