如何判断输入的字符串是电子邮件地址

Function IsEMail(EMail: String): Boolean;
var
    s: String;
    ETpos: Integer;
begin
    ETpos:
= pos('@', EMail); //获取@符号的位置
    if ETpos > 1 then 
    begin 
        s:
= copy(EMail,ETpos+1,Length(EMail)); //截取子串
        if (pos('.', s) > 1) and (pos('.', s) < length(s)) then 
            Result:
= true
        
else 
            Result:
= false
        end
    
else 
        Result:
= false
end;
posted @ 2007-07-09 20:11  sonicit  阅读(889)  评论(0编辑  收藏  举报