电子邮件为字符串型 谢谢大家!!!
解决方案 »
- 怎么获得某一网页的xml代码 ?
- 在线等~~~~存储过程如何自己调用自己的问题!(高手请进)!!!!
- 征集围棋游戏(网络对攻,人对电脑)的方案,算法,策略(0.3)
- SQL语句select好象可以嵌套,怎么用法?
- wep_system_exit和wep_free_dll为什么都说没有定义(关于dll卸载)
- 想提取股票、股指期货的分笔成交数据,有好的接口吗?
- 如何在一个query中做查询
- ADOStoredProc1 调用存储过程中文乱码问题?
- 关于listbox,memo的问题。我等待回答
- Delphi信息列表设计
- 在StringGrid的Cell中如何取消刚刚输入的值
- 急!怎样创建DLL调用数据库并返回记录集?
function IsEMail(EMail: string): Boolean;
const IdChar = 'abcdefghijklmnopqrstuvwxyz1234567890_-.';
var
Tm, S: string;
i, iPos: Integer;
begin
result := False;
EMail := LowerCase(EMail);
iPos := Pos('@', EMail);
if iPos > 1 then
begin
Tm := Copy(EMail, 1, iPos - 1);
if Copy(Tm, 1, 1) = '-' then Exit;
if Copy(Tm, 1, 1) = '_' then Exit;
if Copy(Tm, Length(Tm) - 1, 1) = '-' then Exit;
if Copy(Tm, Length(Tm) - 1, 1) = '_' then Exit;
for i := 1 to Length(Tm) do
if (Pos(Copy(EMail, i, 1), Copy(IdChar, 1, Length(IdChar) - 1)) <= 0) then Exit;
S := Copy(EMail, iPos + 1, Length(EMail) - iPos);
i := Pos('.', S);
if ((i > 1) and (Copy(S, iPos + 1, 1) <> '.') and (Copy(S, i + 1, Length(S)) <> '')) then
begin
if Copy(S, 1, 1) = '-' then Exit;
if Copy(S, 1, 1) = '_' then Exit;
if Copy(S, Length(S) - 1, 1) = '-' then Exit;
if Copy(S, Length(S) - 1, 1) = '_' then Exit;
for i := 1 to Length(S) do
if Pos(Copy(S, i, 1), IdChar) <= 0 then Exit;
result := true;
end;
end;
end;
应该差不多是这个样子吧
感谢你提供的这个函数 想的已经挺周到了
但是好像电子邮件的用户名部分不能以数字开头呀:)