opt and fixed obu ip bug
This commit is contained in:
@@ -6,6 +6,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import java.util.IllegalFormatException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -259,4 +260,17 @@ public final class StringUtils {
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ip校验
|
||||
* @param ipAddress 单个ip
|
||||
* @return
|
||||
*/
|
||||
public static boolean isValidIPAddress(String ipAddress) {
|
||||
if ((ipAddress != null) && (!ipAddress.isEmpty())) {
|
||||
return Pattern.matches("^([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}$", ipAddress);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user