@Test public void camelCaseToDisplay() { assertEquals("Hello World", StringUtils.camelCaseToDisplay("helloWorld")); assertEquals("Hello World", StringUtils.camelCaseToDisplay("HelloWorld")); assertEquals("Hello WWorld", StringUtils.camelCaseToDisplay("HelloWWorld")); }
public static String camelCaseToDisplay(String camelCase) { StringBuilder buf = new StringBuilder(); char ch; boolean lastUpper = false; for (int i = 0, len = camelCase.length(); i < len; i++) { ch = camelCase.charAt(i); if (i == 0) { ch = Character.toUpperCase(ch); lastUpper = true; } else if (Character.isUpperCase(ch)) { if (!lastUpper) { lastUpper = true; buf.append(' '); } } else { lastUpper = false; } buf.append(ch); } return buf.toString(); }
StringUtils { public static String camelCaseToDisplay(String camelCase) { StringBuilder buf = new StringBuilder(); char ch; boolean lastUpper = false; for (int i = 0, len = camelCase.length(); i < len; i++) { ch = camelCase.charAt(i); if (i == 0) { ch = Character.toUpperCase(ch); lastUpper = true; } else if (Character.isUpperCase(ch)) { if (!lastUpper) { lastUpper = true; buf.append(' '); } } else { lastUpper = false; } buf.append(ch); } return buf.toString(); } }
StringUtils { public static String camelCaseToDisplay(String camelCase) { StringBuilder buf = new StringBuilder(); char ch; boolean lastUpper = false; for (int i = 0, len = camelCase.length(); i < len; i++) { ch = camelCase.charAt(i); if (i == 0) { ch = Character.toUpperCase(ch); lastUpper = true; } else if (Character.isUpperCase(ch)) { if (!lastUpper) { lastUpper = true; buf.append(' '); } } else { lastUpper = false; } buf.append(ch); } return buf.toString(); }  }
StringUtils { public static String camelCaseToDisplay(String camelCase) { StringBuilder buf = new StringBuilder(); char ch; boolean lastUpper = false; for (int i = 0, len = camelCase.length(); i < len; i++) { ch = camelCase.charAt(i); if (i == 0) { ch = Character.toUpperCase(ch); lastUpper = true; } else if (Character.isUpperCase(ch)) { if (!lastUpper) { lastUpper = true; buf.append(' '); } } else { lastUpper = false; } buf.append(ch); } return buf.toString(); }  static boolean isReference(String name); static String encodeName(String string); static String encodeName(String string, char[] encode); static String encodeNameOld(String string, char[] encode); static String decodeName(String string); static String decodeNameOld(String string); static String join(Collection<String> strings, String delimiter); static String join(Collection<String> strings,
                              boolean encode, String delimiter); static String join(String[] strings, String delimiter); static String join(String[] strings,
                              boolean encode,
                              String delimiter); static String[] split(String string, boolean decode, String delimiter); static String camelCaseToDisplay(String camelCase); }
StringUtils { public static String camelCaseToDisplay(String camelCase) { StringBuilder buf = new StringBuilder(); char ch; boolean lastUpper = false; for (int i = 0, len = camelCase.length(); i < len; i++) { ch = camelCase.charAt(i); if (i == 0) { ch = Character.toUpperCase(ch); lastUpper = true; } else if (Character.isUpperCase(ch)) { if (!lastUpper) { lastUpper = true; buf.append(' '); } } else { lastUpper = false; } buf.append(ch); } return buf.toString(); }  static boolean isReference(String name); static String encodeName(String string); static String encodeName(String string, char[] encode); static String encodeNameOld(String string, char[] encode); static String decodeName(String string); static String decodeNameOld(String string); static String join(Collection<String> strings, String delimiter); static String join(Collection<String> strings,
                              boolean encode, String delimiter); static String join(String[] strings, String delimiter); static String join(String[] strings,
                              boolean encode,
                              String delimiter); static String[] split(String string, boolean decode, String delimiter); static String camelCaseToDisplay(String camelCase);  }