February 2019
Intermediate to advanced
626 pages
15h 51m
English
ValidateRange tests whether a value, or an array of values, fall within a specified range. ValidateRange is most commonly used to test numeric ranges. However, it is also able to test strings. For example, the z string can be said to be within the A to Z range. This approach is slightly harder to apply when testing strings as the Zz string is greater than Z. The following example uses ValidateRange to test an integer value:
function Test-ValidateRange { [CmdletBinding()] param ( [ValidateRange(1, 20)] [Int]$Parameter1 )}
Read now
Unlock full access