Last active
October 2, 2018 04:11
-
-
Save AntGut/47422c8592f9f7cd785ad9d291c19a33 to your computer and use it in GitHub Desktop.
Pads an input string with spaces.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--== | |
function Pad-String ($InputString, $LeftPadding = 0, $RightPadding = 0) { | |
#--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--== | |
<# | |
.SYNOPSIS | |
LeftPads input string by the specified amount and RightPads if necessary to make output string the specified total length. | |
.DESCRIPTION | |
All LeftPad/RightPad constraints are adhered to. | |
#> | |
if (-not($InputString)) { | |
return "" | |
} | |
return ($InputString.PadLeft($LeftPadding)).PadRight($RightPadding) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment