delphi 检验手机号 IsMobileNumber

2018-10-30

写个函数也可以
  function IsMobileNumber( num:string ):boolean;
  begin
    Result:=False;
    if length( trim( Num ) ) <> 11 then Exit;
    if ( ( copy( num, 1, 2) <> '13' ) and ( copy( num , 1, 2) <> '15' ) ) then Exit;
    try
      StrToInt( copy( num, 3, 9 ) );
      Result:=True;
    except
    end;
  end;

阅读84