src/main/java/Main.java
/**
     * Grab the IP address string from the result of adb shell command.
     * @param content the result of adb shell command.
     * @return ip address or null result.
     */
Grab the IP address string from the result of adb shell command.
@param content the result of adb shell command.
@return ip address or null result.
Grab the IP address string from the result of adb shell command . @param content the result of adb shell command . @return ip address or null result .
public static String grabIP(String content) {
        String reg = "inet\\s(\\d+?\\.\\d+?\\.\\d+?\\.\\d+?)/\\d+";
        Pattern pattern = Pattern.compile(reg);
        Matcher matcher = pattern.matcher(content);
        if (!matcher.find()) {
            return null;
        }
        return matcher.group(1);
    }
public static String grabIP ( String content ) { String reg = "inet\\s(\\d+?\\.\\d+?\\.\\d+?\\.\\d+?)/\\d+" ; Pattern pattern = Pattern . compile ( reg ) ; Matcher matcher = pattern . matcher ( content ) ; if ( ! matcher . find ( ) ) { return null ; } return matcher . group ( 1 ) ; }
Grab the IP address string from the result of adb shell command.
Grab the IP address string from the result of adb shell command .