uses WinSock; function IsValidIP(const aIP: string): Boolean; begin Result :not ((aIP '') or (inet_addr(PChar(aIP)) = INADDR_NONE)); end;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionfunction isValidIP (const aIP : string) : boolean; var listOctet : tstringlist; index : integer; intTest : integer; begin result := true; listOctet := tstringlist.create; listoctet.Delimiter :=';'; listoctet.DelimitedText := Stringreplace('"'+ StringReplace(aIP,'.','";"',[rfReplaceAll])+'"',' ','',[rfReplaceAll]); for index := 0 to listOctet.Count -1 do begin intTest := StrToIntDef (listOctet[index] ,-1) ; if (intTest <0)or(inttest> 255) then result := false; end; if (listOctet.count <> 4)then result := false; listOctet.free; end;
procedure TMainForm.FormCreate(Sender: TObject); begin MaskEdit1.EditMask :='999.999.999.999'; MaskEdit1.Text := ''; MaskEdit1.AutoSelect :=False; end;
Ton p'tit doigt cause des expressions régulières ?Tu aurais pas parlé avec mon p'tit doigt ? T'as pas le droit c'est le mien