delphi 得到IP地址最后一个点后面的值


本文整理自网络,侵删。

 
function ExtractIP(const S: String): String;
var
  I, L, K1, K2: Integer;
  ip:string;
begin
ip:=S+'.';
  L := Length(ip);

  result := '';

  K1 := 0;
  K2 := 0;

  for I:= L downto 1 do //www.delphitop.com 原创 随便转载
    if ip[I] = '.' then
      if K2 = 0 then
        K2 := I
      else
      begin
        K1 := I;
        result := Copy(ip, K1 + 1, K2 - K1 - 1);
        Exit;
      end;
  result := Copy(ip, K1 + 1, K2 - K1 - 1);
end;

相关阅读 >>

Delphi xe取得硬盘序列号代码 复制代码

Delphi indy smtp 发送邮件

Delphi winapi: inflaterect - 改变矩形大小

Delphi内联汇编的一点心得

Delphi toolbar按钮添加图标

Delphi 格式化输出函数(2): formatdatetime

Delphi stringgrid 实例5 本例功能:字体修改为居中,红色,20号

Delphi 窗体不可用

Delphi之format函数

Delphi 时间戳与日期互转

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...