<# FPS:Containers:Common:Public:ConvertTo-ZeroFill:ACTIVE
#>
function ConvertTo-ZeroFill ([int] $pZeros, [string] $pNum) {
<#
.Description
Module: Common
Public CmdLet:
ConvertTo-ZeroFill.ps1
Dependencies: None
This CmdLet left-Zero-pads
the string sent for the number of Zeros to make a
consistent spacing
sequence. It's a
simple re-write of a Legacy CmdLet and is used a good
bit throughout FPS.
.USAGE
Called throughout FPS to determine a CmdLet's
existence. Returns a boolean
balue
.EXAMPLE
if (Push-NeededFor ConvertTo-ZeroFill) { . (Get-ActiveFileNm -PS1 ConvertTo-ZeroFill) }
$newNum=ConvertTo-ZeroFill
4 33
Expected Result: The variable $newString
will be set to "0033"
.CC
[2024.09.25 JD] Original code release
.NOTES
If the fill number <= the current length of the str,
the original str will be returned.
#>
$strNew = ($pNum -as [string])
while ($strNew.length -lt $pZeros) {
$strNew = " "+$strNew }
$strNew
}