字符串IP:192.168.123.26 对应的 数字IP:3232267034
字符串IP --> 数字IP
cast(split("192.168.123.26","\\.")[0] as bigint)*256*256*256+cast(split("192.168.123.26","\\.")[1] as bigint)*256*256+cast(split("192.168.123.26","\\.")[2] as bigint)*256+cast(split("192.168.123.26","\\.")[3] as bigint)
数字IP --> 字符串IP
concat_ws('.',CONV(substr(hex(3232267034),1,2),16,10),CONV(substr(hex(3232267034),3,2),16,10),CONV(substr(hex(3232267034),5,2),16,10),CONV(substr(hex(3232267034),7,2),16,10))
本文详细介绍如何将字符串形式的IP地址转换为数字IP,以及反向操作的方法。通过具体实例演示了转换过程,包括使用bigint进行乘法运算和十六进制转换。
8564

被折叠的 条评论
为什么被折叠?



