Sunday, October 30, 2011

How to check the string whether integer or not?

When you want to check strings as integer, you can use the following code easily:

private
bool checkDigit(string s)

{

System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex("^([0-9]+)$");

return (re.Matches(s).Count > 0);

}

No comments:

Post a Comment