S
sloan
Does anyone know of a way to check a string... being a Number or Decimal...
~~~without exception handling?
(Exceptional Handling is slow ... and it shows on this one)
Here is the gist...but with crappy ExceptionHandling code.:::::::
private static bool IsDecimal(string theValue)
{
bool returnVal = false;
try
{
Convert.ToDouble(theValue , CultureInfo.CurrentCulture );
returnVal = true;
}
catch (FormatException fe)
{
returnVal = false;
}
catch (OverflowException ofe)
{
returnVal = false;
}
finally
{
}
return returnVal;
} //IsDecimal
~~~without exception handling?
(Exceptional Handling is slow ... and it shows on this one)
Here is the gist...but with crappy ExceptionHandling code.:::::::
private static bool IsDecimal(string theValue)
{
bool returnVal = false;
try
{
Convert.ToDouble(theValue , CultureInfo.CurrentCulture );
returnVal = true;
}
catch (FormatException fe)
{
returnVal = false;
}
catch (OverflowException ofe)
{
returnVal = false;
}
finally
{
}
return returnVal;
} //IsDecimal