icinga-powershell-framework/lib/core/tools/Test-IcingaDecimal.psm1

27 lines
499 B
PowerShell
Raw Normal View History

2021-06-03 08:27:03 -04:00
function Test-IcingaDecimal()
{
param (
$Value = $null
);
[hashtable]$RetValue = @{
'Value' = $Value;
'Decimal' = $FALSE;
};
if ($null -eq $Value -Or [string]::IsNullOrEmpty($Value)) {
return $RetValue;
}
$TmpValue = ([string]$Value).Replace(',', '.');
if ((Test-Numeric $TmpValue) -eq $FALSE) {
return $RetValue;
}
$RetValue.Value = [decimal]$TmpValue;
$RetValue.Decimal = $TRUE;
return $RetValue;
}