mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
智能获取IP范围方法新增常用范围符号~ 192.168.0.1~192.168.0.5
This commit is contained in:
parent
d1a4617624
commit
3e696bd84c
@ -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<String> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user