📌  相关文章
📜  在 javascript - C 编程语言代码示例中不使用正则表达式检查电子邮件 ID 是否有效

📅  最后修改于: 2022-03-11 15:04:39.060000             🧑  作者: Mango

代码示例3
function ValidateEmailAddress(emailString) {
    // check for @ sign
    var atSymbol = emailString.indexOf("@");
    if(atSymbol < 1) return false;
    
    var dot = emailString.indexOf(".");
    if(dot <= atSymbol + 2) return false;
    
    // check that the dot is not at the end
    if (dot === emailString.length - 1) return false;
    
    return true;
}