如何在没有逗号的情况下格式化powershell输出为十进制?我正在使用'{0:N2}'-f $ a但我不想要成千上万的逗号.
有许多不同的格式字符串.在你的情况下,我会建议:
'{0:d2}' - f $ a
一个很好的参考是C#中的字符串格式化
其实这里有一些例子:
$a = 124000.4201
'{0:g2}' -f $a
1.2e+05
'{0:f2}' -f $a
124000.42
# and since it is using the .net formatter for all this after all
'{0:00.0000}' -f $a
124000.4201
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14396 次 |
| 最近记录: |