<summary>
///Determines whether strings can be converted to digital
///</summary>
///<param name= "str" > the string to check </ Param>
///<returns>true: can be converted to numbers; false: not digital </returns> public
static bool Isnumberic (string STR)
{
double vsnum;
BOOL Isnum;
Isnum = Double. TryParse (str, System.Globalization.NumberStyles.Float,
System.Globalization.NumberFormatInfo.InvariantInfo , out vsnum);
return isnum;
}
Note
Double.tryparse method (String, NumberStyles, IFormatProvider, Double)
Converts the string representation of a number in a specified style and culture-specific format to its double-precision floating-point numbers equivalent. A return value that indicates whether the conversion succeeded.
public static bool TryParse (
string s,
numberstyles style,
IFormatProvider provider, out
double Result
)
Parameters:
S: A string containing the number to convert.
This paper url:http://www.bianceng.cn/programming/csharp/201410/45583.htm
style: A bitwise combination of NumberStyles values that indicates the format that s is allowed to use. A typical value to specify is a combination of Float and allowthousands.
provider: A IFormatProvider that provides culture-specific formatting information about S.
Result: If the conversion succeeds when this method returns, contains a double-precision floating-point number equivalent to the value or symbol contained in s; If the conversion fails, it contains 0. If the s parameter is a null reference (Nothing in Visual Basic), its format does not conform to style, the number represented is less than minvalue or greater than the MaxValue, or the style is not a valid combination of constants of the NumberStyles enumeration, the conversion fails 。 This parameter is passed without initialization.
return value
True if S is successfully converted, or false.