StringUtils { public static String camelCaseToHumanFriendly(String camelCaseString, boolean capitalize) { if (camelCaseString == null) { return null; } String[] parts = splitCamelCase(camelCaseString); for (int i = 0; i < parts.length; i++) { if (capitalize) { parts[i] = capitalize(parts[i]); } else { parts[i] = i > 0 ? parts[i].toLowerCase() : capitalize(parts[i]); } } return Arrays.stream(parts).collect(Collectors.joining(" ")); } private  StringUtils(); static String camelCaseToHumanFriendly(String camelCaseString, boolean capitalize); static String getHtmlLineBreak(); static boolean isValidEmail(String value); static String prependProtocol(String value); static String propertyIdToHumanFriendly(Object propertyId, boolean capitalize); static String restrictToMaxFieldLength(String value, Class<?> clazz, String fieldName); static final String HTML_LINE_BREAK; }
@Test public void testCamelCaseToHumanFriendly() { assertNull(StringUtils.camelCaseToHumanFriendly(null, true)); assertEquals("Slightly Complex", StringUtils.camelCaseToHumanFriendly("slightlyComplex", true)); assertEquals("Simple", StringUtils.camelCaseToHumanFriendly("simple", true)); assertEquals("Multiple Words Camel", StringUtils.camelCaseToHumanFriendly("multiple wordsCamel", true)); assertEquals("Slightly complex", StringUtils.camelCaseToHumanFriendly("slightlyComplex", false)); assertEquals("Simple", StringUtils.camelCaseToHumanFriendly("simple", false)); assertEquals("Multiple words camel", StringUtils.camelCaseToHumanFriendly("multiple wordsCamel", false)); }