Test for Int in a Web Application
Thursday, June 5, 2008
Useful function No 1
public static bool IsInt(string testStr)
{
string pattern = @"^\d+$";
if (testStr == null)
{
return false;
}
if (testStr.Length == 0)
{
return false;
}
Match matchResult = Regex.Match(testStr, pattern);
return matchResult.Success;
}


0 Comments:
Post a Comment
<< Home