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

18 lines
387 B
PowerShell
Raw Normal View History

<#
.SYNOPSIS
Tests whether a value is numeric
.DESCRIPTION
This module tests whether a value is numeric
2019-10-31 12:24:30 -04:00
More Information on https://github.com/Icinga/icinga-powershell-framework
.EXAMPLE
PS> Test-Numeric 32
True
.LINK
2019-10-31 12:24:30 -04:00
https://github.com/Icinga/icinga-powershell-framework
.NOTES
#>
2019-07-19 13:35:08 -04:00
function Test-Numeric ($number) {
return $number -Match "^-?[0-9]\d*(\.\d+)?$";
2019-07-19 13:35:08 -04:00
}