Buscar

Verifica se a String indicada é um IP.

Código

function IsIP( S: string): boolean;
var i,j,ii: integer;
begin
   Result := false;
   i := pos( ' ', s);
   while i > 0 do begin
      delete( s, i, 1);
      i := pos( ' ', s);
   end;
   j := 0;
   ii := 0;
   for i := 1 to length(s) do
      if s[i] = '.' then
        if i = succ(ii) then exit
        else begin
          inc(j);
          ii := i;
        end;
   if j = 3 then Result := true;
end;

   

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Rede
Adicionada dia: 16/06/09
Por: Denilson De Andrade
Visualizada: 2037 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009