Validate Email Address
-7
Validate Email Address
bool ValidateEmail(CString strEmail)
{
// Declare variables
int nAt, nPeriod;
// Find '@' sign
nAt = strEmail.Find('@');
if(nAt == -1)
{
return false;
}
// Trim left side
strEmail.Delete(0, nAt);
// Find '.'
nPeriod = strEmail.Find('.');
if (nPeriod == -1)
{
return false;
}
return true;
}
{
// Declare variables
int nAt, nPeriod;
// Find '@' sign
nAt = strEmail.Find('@');
if(nAt == -1)
{
return false;
}
// Trim left side
strEmail.Delete(0, nAt);
// Find '.'
nPeriod = strEmail.Find('.');
if (nPeriod == -1)
{
return false;
}
return true;
}






I've got good news, and I've got bad news:
The universe is merely a figment of my imagination.
Now are you ready for the bad news?
This doesn't verify an e-mail address at all.
Bobby R Ward
---------------------
bobbyrward@gmail.com
Yea, boost::regex is the way to go.
- Billism