MCPcopy Create free account
hub / github.com/BaseXdb/basex / camelCase

Method camelCase

basex-core/src/main/java/org/basex/util/Strings.java:319–335  ·  view source on GitHub ↗

Converts a string to camel case. @param string string to convert @return resulting string

(final String string)

Source from the content-addressed store, hash-verified

317 * @return resulting string
318 */
319 public static String camelCase(final String string) {
320 final StringBuilder sb = new StringBuilder();
321 boolean upper = false;
322 final int sl = string.length();
323 for(int s = 0; s < sl; s++) {
324 final char ch = string.charAt(s);
325 if(ch == '-') {
326 upper = true;
327 } else if(upper) {
328 sb.append(Character.toUpperCase(ch));
329 upper = false;
330 } else {
331 sb.append(ch);
332 }
333 }
334 return sb.toString();
335 }
336
337 /**
338 * Converts the given string to a Java class name. Slashes will be replaced with dots, and

Callers 4

camelCaseMethod · 0.95
itemMethod · 0.95
getMethod · 0.95
uriToClasspathMethod · 0.95

Calls 4

charAtMethod · 0.80
appendMethod · 0.65
toStringMethod · 0.65
lengthMethod · 0.45

Tested by 1

camelCaseMethod · 0.76