/** * A name of the form "foo-bar-whatnot" is turned into "Foo: Bar Whatnot" */ public static String unshellifyName(String name) { if (Strings.isNotBlank(name)) { if (name.indexOf('-') >= 0 && name.toLowerCase().equals(name)) { String[] split = name.split("-"); StringBuffer buffer = new StringBuffer(); int idx = 0; for (String part : split) { if (idx == 1) { buffer.append(": "); } else if (idx > 1) { buffer.append(" "); } buffer.append(capitalize(part)); idx++; } return buffer.toString(); } } return name; }
/** * A name of the form "foo-bar-whatnot" is turned into "Foo: Bar Whatnot" */ public static String unshellifyName(String name) { if (Strings.isNotBlank(name)) { if (name.indexOf('-') >= 0 && name.toLowerCase().equals(name)) { String[] split = name.split("-"); StringBuffer buffer = new StringBuffer(); int idx = 0; for (String part : split) { if (idx == 1) { buffer.append(": "); } else if (idx > 1) { buffer.append(" "); } buffer.append(capitalize(part)); idx++; } return buffer.toString(); } } return name; }