Saturday, November 7, 2015

Formatting strings in PowerShell

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:

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