@Test public void test_getSimpleName() throws Exception { assertEquals("cn/MemberService:1.0.0", Tool.getSimpleName("cn/com.alibaba.morgan.MemberService:1.0.0")); assertEquals("cn/MemberService", Tool.getSimpleName("cn/com.alibaba.morgan.MemberService")); assertEquals("MemberService:1.0.0", Tool.getSimpleName("com.alibaba.morgan.MemberService:1.0.0")); assertEquals("MemberService", Tool.getSimpleName("com.alibaba.morgan.MemberService")); }
public static String getSimpleName(String name) { if (name != null && name.length() > 0) { final int ip = name.indexOf('/'); String v = ip != -1 ? name.substring(0, ip + 1) : ""; int i = name.lastIndexOf(':'); int j = (i >= 0 ? name.lastIndexOf('.', i) : name.lastIndexOf('.')); if (j >= 0) { name = name.substring(j + 1); } name = v + name; } return name; }
Tool { public static String getSimpleName(String name) { if (name != null && name.length() > 0) { final int ip = name.indexOf('/'); String v = ip != -1 ? name.substring(0, ip + 1) : ""; int i = name.lastIndexOf(':'); int j = (i >= 0 ? name.lastIndexOf('.', i) : name.lastIndexOf('.')); if (j >= 0) { name = name.substring(j + 1); } name = v + name; } return name; } }
Tool { public static String getSimpleName(String name) { if (name != null && name.length() > 0) { final int ip = name.indexOf('/'); String v = ip != -1 ? name.substring(0, ip + 1) : ""; int i = name.lastIndexOf(':'); int j = (i >= 0 ? name.lastIndexOf('.', i) : name.lastIndexOf('.')); if (j >= 0) { name = name.substring(j + 1); } name = v + name; } return name; }  }
Tool { public static String getSimpleName(String name) { if (name != null && name.length() > 0) { final int ip = name.indexOf('/'); String v = ip != -1 ? name.substring(0, ip + 1) : ""; int i = name.lastIndexOf(':'); int j = (i >= 0 ? name.lastIndexOf('.', i) : name.lastIndexOf('.')); if (j >= 0) { name = name.substring(j + 1); } name = v + name; } return name; }  static boolean startWith(String value, String prefix); static boolean isContains(String[] values, String value); static boolean isValidAddress(String address); static String getHostName(String address); static String getIP(String address); static String encodeUrl(String url); static String decodeUrl(String url); static String encodeHtml(String html); static String decodeHtml(String html); static int countMapValues(Map<?, ?> map); static List<String> sortSimpleName(List<String> list); static String getSimpleName(String name); }
Tool { public static String getSimpleName(String name) { if (name != null && name.length() > 0) { final int ip = name.indexOf('/'); String v = ip != -1 ? name.substring(0, ip + 1) : ""; int i = name.lastIndexOf(':'); int j = (i >= 0 ? name.lastIndexOf('.', i) : name.lastIndexOf('.')); if (j >= 0) { name = name.substring(j + 1); } name = v + name; } return name; }  static boolean startWith(String value, String prefix); static boolean isContains(String[] values, String value); static boolean isValidAddress(String address); static String getHostName(String address); static String getIP(String address); static String encodeUrl(String url); static String decodeUrl(String url); static String encodeHtml(String html); static String decodeHtml(String html); static int countMapValues(Map<?, ?> map); static List<String> sortSimpleName(List<String> list); static String getSimpleName(String name);  }