@Test public void splitIpPort() { String[] res = URLUtil.splitIpPort("http: Assert.assertEquals(res[0], "0.0.0.0"); Assert.assertEquals(res[1], "3000"); }
public static String[] splitIpPort(String url) { String[] res = new String[2]; res[0] = url .substring(url.indexOf(SCHEMA_SEPRATOR) + SCHEMA_SEPRATOR.length(), url.lastIndexOf(IPPORT_SEPRATOR)); res[1] = url.substring(url.lastIndexOf(IPPORT_SEPRATOR) + 1); if (res[1].contains("/")) { res[1] = res[1].substring(0, res[1].indexOf("/")); } else if (res[1].contains("?")) { res[1] = res[1].substring(0, res[1].indexOf("?")); } return res; }
URLUtil { public static String[] splitIpPort(String url) { String[] res = new String[2]; res[0] = url .substring(url.indexOf(SCHEMA_SEPRATOR) + SCHEMA_SEPRATOR.length(), url.lastIndexOf(IPPORT_SEPRATOR)); res[1] = url.substring(url.lastIndexOf(IPPORT_SEPRATOR) + 1); if (res[1].contains("/")) { res[1] = res[1].substring(0, res[1].indexOf("/")); } else if (res[1].contains("?")) { res[1] = res[1].substring(0, res[1].indexOf("?")); } return res; } }
URLUtil { public static String[] splitIpPort(String url) { String[] res = new String[2]; res[0] = url .substring(url.indexOf(SCHEMA_SEPRATOR) + SCHEMA_SEPRATOR.length(), url.lastIndexOf(IPPORT_SEPRATOR)); res[1] = url.substring(url.lastIndexOf(IPPORT_SEPRATOR) + 1); if (res[1].contains("/")) { res[1] = res[1].substring(0, res[1].indexOf("/")); } else if (res[1].contains("?")) { res[1] = res[1].substring(0, res[1].indexOf("?")); } return res; }  }
URLUtil { public static String[] splitIpPort(String url) { String[] res = new String[2]; res[0] = url .substring(url.indexOf(SCHEMA_SEPRATOR) + SCHEMA_SEPRATOR.length(), url.lastIndexOf(IPPORT_SEPRATOR)); res[1] = url.substring(url.lastIndexOf(IPPORT_SEPRATOR) + 1); if (res[1].contains("/")) { res[1] = res[1].substring(0, res[1].indexOf("/")); } else if (res[1].contains("?")) { res[1] = res[1].substring(0, res[1].indexOf("?")); } return res; }  static String[] splitIpPort(String url); static String transform(String restUrl); static boolean isEquals(String url1, String url2); static List<String> dealMultiUrl(String urls); static List<String> getEnvConfigUrl(); static List<String> getEnvServerURL(); }
URLUtil { public static String[] splitIpPort(String url) { String[] res = new String[2]; res[0] = url .substring(url.indexOf(SCHEMA_SEPRATOR) + SCHEMA_SEPRATOR.length(), url.lastIndexOf(IPPORT_SEPRATOR)); res[1] = url.substring(url.lastIndexOf(IPPORT_SEPRATOR) + 1); if (res[1].contains("/")) { res[1] = res[1].substring(0, res[1].indexOf("/")); } else if (res[1].contains("?")) { res[1] = res[1].substring(0, res[1].indexOf("?")); } return res; }  static String[] splitIpPort(String url); static String transform(String restUrl); static boolean isEquals(String url1, String url2); static List<String> dealMultiUrl(String urls); static List<String> getEnvConfigUrl(); static List<String> getEnvServerURL();  }