|
Welcome to NValidate.org!
NValidate is a validation library that turns this:
protected int getPlus4(string zipCode)
{
const string ZipPlus4Pattern = "\\d[5]-\\d[4]";
const string ZipPlus4Error = "Not a valid ZIP+4 Code.";
if (zipCode == null)
throw new ArgumentNullException("zipCode");
if (zipCode == string.Empty)
throw new ArgumentException("Empty
strings not permitted.");
if (!((new Regex(ZipPlus4Pattern)).IsMatch(zipCode)))
throw new ArgumentNullException(ZipPlus4Error, "zipCode");
return int.Parse(zipCode.Substring(6, 4));
}
into this:
protected int getPlus4(string zipCode)
{
const string ZipPlus4Pattern = "\\d[5]-\\d[4]";
const string ZipPlus4Error = "Not a valid ZIP+4 Code.";
Demand.That(zipCode, "zipCode").IsNotNullOrEmpty().Matches(ZipPlus4Pattern, ZipPlus4Error);
return int.Parse(zipCode.Substring(6, 4));
}
We've now made the initial alpha release of NValidate, and are working towards
the next release. In the meanwhile,
please feel free to peruse the documentation available via the links on the left.
You can get the most recent news from the NValidate Blog.
You're also invited to take part in our NValidate
Community Forums.
Thanks, and enjoy your stay!
Mike Hofer
NValidate Developer
|