@Test @DisplayName("camel converts an empty string") void camelConvertsEmpty() { assertEquals("", camel("")); }
public static String camel(String s) { if (s == null) { return null; } final var result = new char[s.length()]; int dst = 0; var capIt = true; for (int src = 0; src < s.length(); src++) { if (s.charAt(src) == '_') { capIt = true; } else { if (capIt) { capIt = false; result[dst++] = Character.toUpperCase(s.charAt(src)); } else { result[dst++] = Character.toLowerCase(s.charAt(src)); } } } return new String(result, 0, dst); }
CaseTools { public static String camel(String s) { if (s == null) { return null; } final var result = new char[s.length()]; int dst = 0; var capIt = true; for (int src = 0; src < s.length(); src++) { if (s.charAt(src) == '_') { capIt = true; } else { if (capIt) { capIt = false; result[dst++] = Character.toUpperCase(s.charAt(src)); } else { result[dst++] = Character.toLowerCase(s.charAt(src)); } } } return new String(result, 0, dst); } }
CaseTools { public static String camel(String s) { if (s == null) { return null; } final var result = new char[s.length()]; int dst = 0; var capIt = true; for (int src = 0; src < s.length(); src++) { if (s.charAt(src) == '_') { capIt = true; } else { if (capIt) { capIt = false; result[dst++] = Character.toUpperCase(s.charAt(src)); } else { result[dst++] = Character.toLowerCase(s.charAt(src)); } } } return new String(result, 0, dst); }  }
CaseTools { public static String camel(String s) { if (s == null) { return null; } final var result = new char[s.length()]; int dst = 0; var capIt = true; for (int src = 0; src < s.length(); src++) { if (s.charAt(src) == '_') { capIt = true; } else { if (capIt) { capIt = false; result[dst++] = Character.toUpperCase(s.charAt(src)); } else { result[dst++] = Character.toLowerCase(s.charAt(src)); } } } return new String(result, 0, dst); }  static String lcase(String s); static String ucase(String s); static String camel(String s); static String snake(String s); }
CaseTools { public static String camel(String s) { if (s == null) { return null; } final var result = new char[s.length()]; int dst = 0; var capIt = true; for (int src = 0; src < s.length(); src++) { if (s.charAt(src) == '_') { capIt = true; } else { if (capIt) { capIt = false; result[dst++] = Character.toUpperCase(s.charAt(src)); } else { result[dst++] = Character.toLowerCase(s.charAt(src)); } } } return new String(result, 0, dst); }  static String lcase(String s); static String ucase(String s); static String camel(String s); static String snake(String s);  }