Mengecek Alamat Email dengan Delphi


Tips & Trik Delphi, Tips Belajar Delphi, Belajar Delphi Online
unit CekMail;

 

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,StdCtrls;

type

TForm1 = class(TForm)Button1: TButton;Edit1: TEdit;

Label1: TLabel;

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.DFM}

function CekEMail(EMail: String): Boolean;

var

s: String;

posisi: Integer;

begin

posisi:= pos(‘@’, EMail);

if posisi > 1 then

begin

s:= copy(EMail,posisi+1,Length(EMail));

if (pos(‘.’, s) > 1) and (pos(‘.’, s) < length(s)) then

Result:= true else Result:= false;

end

else

Result:= false;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

if CekEmail(Edit1.Text) then

begin

ShowMessage(‘Format e-mail sudah benar‘);

end

else

begin

ShowMessage(‘Cek kembali’);

end

end;

end.

TransCODE Software

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s