@Test public void toCamelCase() { String str1 = "To_CAmEL_CaSE"; String str2 = BeanUtil.toCamelCase(str1); Assert.equals(str2, "toCamelCase", ErrorCodeDef.SYSTEM_ERROR_10001); }
public static String toCamelCase(final String str) { if (str == null) { return null; } String s = str.toLowerCase(); StringBuilder sb = new StringBuilder(s.length()); boolean upperCase = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == GlobalConstants.UNDERLINE) { upperCase = true; } else if (upperCase) { sb.append(Character.toUpperCase(c)); upperCase = false; } else { sb.append(c); } } return sb.toString(); }
BeanUtil { public static String toCamelCase(final String str) { if (str == null) { return null; } String s = str.toLowerCase(); StringBuilder sb = new StringBuilder(s.length()); boolean upperCase = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == GlobalConstants.UNDERLINE) { upperCase = true; } else if (upperCase) { sb.append(Character.toUpperCase(c)); upperCase = false; } else { sb.append(c); } } return sb.toString(); } }
BeanUtil { public static String toCamelCase(final String str) { if (str == null) { return null; } String s = str.toLowerCase(); StringBuilder sb = new StringBuilder(s.length()); boolean upperCase = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == GlobalConstants.UNDERLINE) { upperCase = true; } else if (upperCase) { sb.append(Character.toUpperCase(c)); upperCase = false; } else { sb.append(c); } } return sb.toString(); }  }
BeanUtil { public static String toCamelCase(final String str) { if (str == null) { return null; } String s = str.toLowerCase(); StringBuilder sb = new StringBuilder(s.length()); boolean upperCase = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == GlobalConstants.UNDERLINE) { upperCase = true; } else if (upperCase) { sb.append(Character.toUpperCase(c)); upperCase = false; } else { sb.append(c); } } return sb.toString(); }  static boolean isAbstract(final Method method); static String[] getMethodParamNames(final Class<?> clazz, final String method, final Class<?>... paramTypes); static String[] getMethodParamNames(final Method method); static String getMethodSignature(final Method method); static Set<Class<?>> getClasses(final String pk); static String toUnderlineName(final String s); static String toCamelCase(final String str); static String camelStr2underLine(final String camelStr); static String toCapitalizeCamelCase(final String str); static boolean isSimpleValueType(final Class<?> clazz); static boolean isSimpleProperty(final Class<?> clazz); }
BeanUtil { public static String toCamelCase(final String str) { if (str == null) { return null; } String s = str.toLowerCase(); StringBuilder sb = new StringBuilder(s.length()); boolean upperCase = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == GlobalConstants.UNDERLINE) { upperCase = true; } else if (upperCase) { sb.append(Character.toUpperCase(c)); upperCase = false; } else { sb.append(c); } } return sb.toString(); }  static boolean isAbstract(final Method method); static String[] getMethodParamNames(final Class<?> clazz, final String method, final Class<?>... paramTypes); static String[] getMethodParamNames(final Method method); static String getMethodSignature(final Method method); static Set<Class<?>> getClasses(final String pk); static String toUnderlineName(final String s); static String toCamelCase(final String str); static String camelStr2underLine(final String camelStr); static String toCapitalizeCamelCase(final String str); static boolean isSimpleValueType(final Class<?> clazz); static boolean isSimpleProperty(final Class<?> clazz);  }