Ver Mensaje Individual
  #5  
Antiguo 30-09-2003
Avatar de roman
roman roman is offline
Moderador
 
Registrado: may 2003
Ubicación: Ciudad de México
Posts: 20.269
Reputación: 10
roman Es un diamante en brutoroman Es un diamante en brutoroman Es un diamante en bruto
Otra forma:

Código:
function IsValidIP(S: String): Boolean;
var
  Strings: TStringList;

begin
  Result := false;

  Strings := TStringList.Create;
  Strings.Delimiter := '.';
  Strings.DelimitedText := S;

  if Strings.Count <> 4 then exit;

  repeat
    Result := (StrToIntDef(Strings[0], -1) in [0..255]);
    Strings.Delete(0);
  until (Strings.Count = 0) or not Result;

  Strings.Free;
end;
// Saludos

Última edición por roman fecha: 30-09-2003 a las 17:07:46.
Responder Con Cita