Check For Numeric Characters

by Jun 21, 2011

Try this if you need to check a single character and find out whether or not it is numeric:

PS > [char]::IsNumber('1')
True
PS > [char]::IsNumber('A')
False

 

The type Char has a bunch of other useful methods. Here is a list that you can try:

[char] | Get-Member -static

 

 

Twitter This Tip!
ReTweet this Tip!