This class consists of the commonly used validations which you will find useful in your project. Each line of code is commented in detail for quick understanding of the method.
Implementation is pretty simple. You will just have to pass your input data and check for the boolean.
Usage of the methods in class are pretty straight forward
1 ) IsInteger (string value);
if (DataValidator.IsInteger("123")
{
//Valid Data
}
else
{
//Invalid Data
}
2 ) IsAlpha(string value) ;if (DataValidator.IsAlpha("data2"))
{
//Valid Data
}
else
{
//Invalid Data
}
3 ) IsDecimal(string value);if (DataValidator.IsDecimal("2.234"))
{
//Valid Data
}
else
{
//Invalid Data
}
4 ) IsIPAddress(string value) ;if (DataValidator.IsIPAddress("127.0.0.1"))
{
//Valid Data
}
else
{
//Invalid Data
}
5 ) IsURL(string value);if (DataValidator.IsURL("http://www.codecanyon.net"))
{
//Valid Data
}
else
{
//Invalid Data
}
6 ) IsEMailAddress(String value);if (DataValidator.IsEMailAddress("me(at)example.com"))
{
//Valid Data
}
else
{
//Invalid Data
}
7 ) IsHexColor(string value);if (DataValidator.IsHexColor("#FFFFFF"))
{
//Valid Data
}
else
{
//Invalid Data
}
8 ) IsDate(string value);if (DataValidator.IsDate("12-Jan-2009"))
{
//Valid Data
}
else
{
//Invalid Data
}
No comments:
Post a Comment