If you done programming in .NET/C# before, you are probably very familiar with using the string.Format function to provide structure and string formatting for your strings.
However, if you are new to PowerShell, you may not know how to perform the same task in PowerShell.
Fortunately, using string formatting in PowerShell is just as easy as in .NET/C#!
You can read more about how to do string formatting in PowerShell here: http://blogs.technet.com/b/heyscriptingguy/archive/2013/03/12/use-powershell-to-format-strings-with-composite-formatting.aspx
The most common implementation is definitely this:
However, if you are new to PowerShell, you may not know how to perform the same task in PowerShell.
Fortunately, using string formatting in PowerShell is just as easy as in .NET/C#!
You can read more about how to do string formatting in PowerShell here: http://blogs.technet.com/b/heyscriptingguy/archive/2013/03/12/use-powershell-to-format-strings-with-composite-formatting.aspx
The most common implementation is definitely this:
"This is my first string {0} and this is my second string {1}" -f "Scrooge", "McDuck"
No comments:
Post a Comment