• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
KXLF’s blog
能转的不写
   首页    新随笔    联系   管理     

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

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

posted @ 2011-12-05 10:26  KXLF  阅读(1040)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3