From 8adbf36a350ccc348b8bdf30a554fbf2b0a69cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E9=87=91=E6=88=90?= <5644303+ktkea@user.noreply.gitee.com> Date: Wed, 26 Mar 2025 19:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E8=83=BD=E8=8E=B7=E5=8F=96IP=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E6=96=B9=E6=B3=95=E6=96=B0=E5=A2=9E=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E7=AC=A6=E5=8F=B7~=20192.168.0.1~192.168.0.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hutool-core/src/main/java/cn/hutool/core/net/Ipv4Util.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hutool-core/src/main/java/cn/hutool/core/net/Ipv4Util.java b/hutool-core/src/main/java/cn/hutool/core/net/Ipv4Util.java index 569fef3b2..85e76ec4e 100755 --- a/hutool-core/src/main/java/cn/hutool/core/net/Ipv4Util.java +++ b/hutool-core/src/main/java/cn/hutool/core/net/Ipv4Util.java @@ -31,6 +31,11 @@ public class Ipv4Util { */ public static final String IP_SPLIT_MARK = "-"; + /** + * IP段的分割符 + */ + public static final String IP_SPLIT_TILDE = "~"; + /** * IP与掩码的分割符 */ @@ -60,6 +65,7 @@ public class Ipv4Util { * @return IP集 */ public static List list(String ipRange, boolean isAll) { + ipRange = ipRange.replaceAll(IP_SPLIT_TILDE,IP_SPLIT_MARK); if (ipRange.contains(IP_SPLIT_MARK)) { // X.X.X.X-X.X.X.X final String[] range = StrUtil.splitToArray(ipRange, IP_SPLIT_MARK);