icinga-powershell-framework/lib/core/tools/Format-IcingaDigitCount.psm1
2019-09-16 17:53:29 +02:00

23 lines
437 B
PowerShell

function Format-IcingaDigitCount()
{
param(
[string]$Value,
[int]$Digits,
[string]$Symbol = 0
);
if ([string]::IsNullOrEmpty($Value)) {
return $Value;
}
$CurrentLength = $Value.Length;
if ($CurrentLength -ge $Digits) {
return $Value;
}
while ($Value.Length -lt $Digits) {
$Value = [string]::Format('{0}{1}', $Symbol, $Value);
}
return $Value;
}