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 十进制十六进制转换

Delphi idhttpserver接收http get请求解码问题

Delphi 图像分割

print documents from Delphi - print pdf, doc, xls, html, rtf, docx, txt

Delphi 去掉mdi窗口的滚动条

Delphi 泛型数组 strsplit 字符串分割

Delphi回调函数高级应用

Delphi研究之驱动开发篇(七)--利用共享内存与用户模式

Delphi判断字符串是否是数字、字母、大小写字母

Delphi ado组件动态连接access数据库

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



打赏

取消

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

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

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

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

评论

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