mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
* Added new function Format-IcingaDigitCount to fill digits with leading 0 depending on missing values * Added this function to CPU check
22 lines
397 B
PowerShell
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;
|
|
}
|