Extended digit format with custom symbol

This commit is contained in:
Lord Hepipud 2019-09-16 17:53:29 +02:00
parent 60e7a52986
commit c27df29aeb

View file

@ -2,7 +2,8 @@ function Format-IcingaDigitCount()
{ {
param( param(
[string]$Value, [string]$Value,
[int]$Digits [int]$Digits,
[string]$Symbol = 0
); );
if ([string]::IsNullOrEmpty($Value)) { if ([string]::IsNullOrEmpty($Value)) {
@ -15,7 +16,7 @@ function Format-IcingaDigitCount()
} }
while ($Value.Length -lt $Digits) { while ($Value.Length -lt $Digits) {
$Value = [string]::Format('0{0}', $Value); $Value = [string]::Format('{0}{1}', $Symbol, $Value);
} }
return $Value; return $Value;