现在的位置: 首页 > 综合 > 正文

[转]How to use String.Format in PowerShell?(如何在PowerShell中使用string.format?)

2012年04月22日 ⁄ 综合 ⁄ 共 403字 ⁄ 字号 评论关闭

Hah! (We’re back ;-) ) It’s as easy as that:

 

PS > [string] :: Format( "Hello {0} {1} :-)""Daniel""Walzenbach") 
Hello Daniel Walzenbach :-)

 

Needless to say that other formatting – like Currency formatting – works as well

 

PS > [string] :: Format( "{0:C}"1234567890
$1,234,567,890.00

 

Check out Formatting Types on the .NET Framework Developer's Guide or SteveX Compiled - String Formatting in C#(nice cheat sheet) for more examples.

Cheers!

   Daniel

抱歉!评论已关闭.