/ Published in: Windows PowerShell

For clarity, I have broken two variables out, but this could easily be a one-liner.
Usage:
Replace X with the character you wish to use to pad (e.g. 0 (zero)).
Replace Y with an integer representing the desired TOTAL length of the string.
Usage:
Replace X with the character you wish to use to pad (e.g. 0 (zero)).
Replace Y with an integer representing the desired TOTAL length of the string.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
[string]$stringToPad = 1 $padChar = "X" $paddedLength = 4 $stringToPad = ($padChar * ($paddedLength - $stringToPad.Length)) + $stringToPad
Comments
