In a C# 2010 application I would like to see if the value in the following is numeric:
strPID.Substring(3, 8).
Thus can you tell me how to see if the value in the substring starting at position 3 for a length of 8 is numeric?
Check for numeric
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Sep 12, 2012, 10:42 AM EDT
string s = strPID.Substring(3, 8);
double d;
if (Double.TryParse(s, out d))
{
// it's numeric and value contained in 'd'
}
else
{
// it's not numeric and value of 'd' is 0
}