现在的位置: 首页 > 综合 > 正文

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

2012年03月04日 ⁄ 综合 ⁄ 共 384字 ⁄ 字号 评论关闭
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;

抱歉!评论已关闭.