@Test public void testCamelToSplitName() throws Exception { assertEquals("ab-cd-ef", StringUtils.camelToSplitName("abCdEf", "-")); assertEquals("ab-cd-ef", StringUtils.camelToSplitName("AbCdEf", "-")); assertEquals("ab-cd-ef", StringUtils.camelToSplitName("ab-cd-ef", "-")); assertEquals("abcdef", StringUtils.camelToSplitName("abcdef", "-")); }
public static String camelToSplitName(String camelName, String split) { if (camelName == null || camelName.length() == 0) { return camelName; } StringBuilder buf = null; for (int i = 0; i < camelName.length(); i++) { char ch = camelName.charAt(i); if (ch >= 'A' && ch <= 'Z') { if (buf == null) { buf = new StringBuilder(); if (i > 0) { buf.append(camelName.substring(0, i)); } } if (i > 0) { buf.append(split); } buf.append(Character.toLowerCase(ch)); } else if (buf != null) { buf.append(ch); } } return buf == null ? camelName : buf.toString(); }
StringUtils { public static String camelToSplitName(String camelName, String split) { if (camelName == null || camelName.length() == 0) { return camelName; } StringBuilder buf = null; for (int i = 0; i < camelName.length(); i++) { char ch = camelName.charAt(i); if (ch >= 'A' && ch <= 'Z') { if (buf == null) { buf = new StringBuilder(); if (i > 0) { buf.append(camelName.substring(0, i)); } } if (i > 0) { buf.append(split); } buf.append(Character.toLowerCase(ch)); } else if (buf != null) { buf.append(ch); } } return buf == null ? camelName : buf.toString(); } }
StringUtils { public static String camelToSplitName(String camelName, String split) { if (camelName == null || camelName.length() == 0) { return camelName; } StringBuilder buf = null; for (int i = 0; i < camelName.length(); i++) { char ch = camelName.charAt(i); if (ch >= 'A' && ch <= 'Z') { if (buf == null) { buf = new StringBuilder(); if (i > 0) { buf.append(camelName.substring(0, i)); } } if (i > 0) { buf.append(split); } buf.append(Character.toLowerCase(ch)); } else if (buf != null) { buf.append(ch); } } return buf == null ? camelName : buf.toString(); } private  StringUtils(); }
StringUtils { public static String camelToSplitName(String camelName, String split) { if (camelName == null || camelName.length() == 0) { return camelName; } StringBuilder buf = null; for (int i = 0; i < camelName.length(); i++) { char ch = camelName.charAt(i); if (ch >= 'A' && ch <= 'Z') { if (buf == null) { buf = new StringBuilder(); if (i > 0) { buf.append(camelName.substring(0, i)); } } if (i > 0) { buf.append(split); } buf.append(Character.toLowerCase(ch)); } else if (buf != null) { buf.append(ch); } } return buf == null ? camelName : buf.toString(); } private  StringUtils(); static boolean isBlank(String str); static boolean isEmpty(String str); static boolean isNotEmpty(String str); static boolean isEquals(String s1, String s2); static boolean isInteger(String str); static int parseInteger(String str); static boolean isJavaIdentifier(String s); static boolean isContains(String values, String value); static boolean isContains(String[] values, String value); static boolean isNumeric(String str); static String toString(Throwable e); static String toString(String msg, Throwable e); static String translat(String src, String from, String to); static String[] split(String str, char ch); static String join(String[] array); static String join(String[] array, char split); static String join(String[] array, String split); static String join(Collection<String> coll, String split); static String getQueryStringValue(String qs, String key); static Map<String, String> parseQueryString(String qs); static String getServiceKey(Map<String, String> ps); static String toQueryString(Map<String, String> ps); static String camelToSplitName(String camelName, String split); static String toArgumentString(Object[] args); }
StringUtils { public static String camelToSplitName(String camelName, String split) { if (camelName == null || camelName.length() == 0) { return camelName; } StringBuilder buf = null; for (int i = 0; i < camelName.length(); i++) { char ch = camelName.charAt(i); if (ch >= 'A' && ch <= 'Z') { if (buf == null) { buf = new StringBuilder(); if (i > 0) { buf.append(camelName.substring(0, i)); } } if (i > 0) { buf.append(split); } buf.append(Character.toLowerCase(ch)); } else if (buf != null) { buf.append(ch); } } return buf == null ? camelName : buf.toString(); } private  StringUtils(); static boolean isBlank(String str); static boolean isEmpty(String str); static boolean isNotEmpty(String str); static boolean isEquals(String s1, String s2); static boolean isInteger(String str); static int parseInteger(String str); static boolean isJavaIdentifier(String s); static boolean isContains(String values, String value); static boolean isContains(String[] values, String value); static boolean isNumeric(String str); static String toString(Throwable e); static String toString(String msg, Throwable e); static String translat(String src, String from, String to); static String[] split(String str, char ch); static String join(String[] array); static String join(String[] array, char split); static String join(String[] array, String split); static String join(Collection<String> coll, String split); static String getQueryStringValue(String qs, String key); static Map<String, String> parseQueryString(String qs); static String getServiceKey(Map<String, String> ps); static String toQueryString(Map<String, String> ps); static String camelToSplitName(String camelName, String split); static String toArgumentString(Object[] args); static final String[] EMPTY_STRING_ARRAY; }