icinga-powershell-framework/lib/core/tools/Format-IcingaDigitCount.psm1
Lord Hepipud 423791750a Added tool function to increase digit count
* Added new function Format-IcingaDigitCount to fill digits with leading 0 depending on missing values
* Added this function to CPU check
2019-09-16 17:32:25 +02:00

22 lines
397 B
PowerShell

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