How can I tell if a string in PowerShell contains a number?

I came across a scenario where I wanted to handle data that contained a number in the string one way and everything else a different way.  Using the Get-type() didn’t work for this case because the variable was handles as a string.

PS C:\> $test = "abc123"PS C:\> $test.GetType().fullnameSystem.String 

I saw that there were some people on the intertubes that worked through this by splitting the string into an array and getting the ASCII value for each character and checking their value to see if they were in the range.  Something like this;

$Check = "abc123"$Sort = [int[]][char[]]$Check

foreach ($Value in $Sort){     if ( (($Value -ge 65) -and  ($Value -le 90)) -or (($Value -ge 97) -and  ($Value -le 122)) )         {                 write-host "Letter"    }}



The way I worked out was to check the string against a basic regex pattern to see if any of it matched a number 0-9;

$Check = "abc123"if($Check -match "[0-9]")

{    write-host "Number"}