普通方法验证Email正确性
public static boolean validateEmail(String text)
{
int atIndex = text.indexOf('@');
int dotLastIndex = text.lastIndexOf('.');
//必须含有@和.
if (atIndex < 0 || dotLastIndex < 0)
{
return false;
}
int textLen = text.length();
//不能以@或者.开始或者结束
if (atIndex == 0 || atIndex == textLen || dotLastIndex == 0
|| dotLastIndex == textLen)
{
return false;
}
//@要在最后一个.之前
if (atIndex > dotLastIndex)
{
return false;
}
return true;
}
@原著:http://blog.csdn.net/cownew/article/details/6477989