zoukankan      html  css  js  c++  java
  • 检查IP地址是否有效(delphi)

     
    Function Checkip(const Ip:String):byte;
    var
      i,k:Integer;
      s1:String;
    begin
      Result:=0;
      s1:=Ip;
      i:= Pos('.',s1);
      s1 := s1 + '.';
      while i > 0 do
      begin
        if not Length(Copy(s1,1,i)) in [2..4] then
          break;
        k:=StrTointDef(Copy(s1,1,i-1),-1);
        if (k<0) or (k>255) then
          Break;
        inc(Result);
        if Result>4 then
          Exit;
        system.Delete(s1,1,i);
        i:= Pos('.',s1);
      end;
    end;

  • 相关阅读:
    2017.4.18下午
    2017.4.18上午
    2017.4.17上午
    2017.4.14下午
    2017.4.14上午
    4.17下午
    4.17上午
    4.13下午
    4.13上午
    4.10上午
  • 原文地址:https://www.cnblogs.com/yoogoo/p/2479977.html
Copyright © 2011-2022 走看看