@Test public void humanize() { assertThat(Inflector.humanize("foo_bar"), is("Foo Bar")); assertThat(Inflector.humanize("FOO_BAR"), is("Foo Bar")); assertThat(Inflector.humanize("fooBar"), is("Foo Bar")); assertThat(Inflector.humanize("foo bar"), is("Foo Bar")); assertThat(Inflector.humanize("Foo Bar"), is("Foo Bar")); assertThat(Inflector.humanize("a_b"), is("A B")); assertThat(Inflector.humanize("aB"), is("A B")); assertThat(Inflector.humanize("ab"), is("Ab")); assertThat(Inflector.humanize("FOO"), is("Foo")); assertThat(Inflector.humanize("FOo"), is("Foo")); }
public static String humanize(final String camelCased) { String name = ""; for (final Iterator<String> i = split(camelCased).iterator(); i.hasNext();) { String part = capitalize(i.next().toLowerCase()); if (!part.isEmpty()) { name += part; if (i.hasNext()) { name += " "; } } } return name; }
Inflector { public static String humanize(final String camelCased) { String name = ""; for (final Iterator<String> i = split(camelCased).iterator(); i.hasNext();) { String part = capitalize(i.next().toLowerCase()); if (!part.isEmpty()) { name += part; if (i.hasNext()) { name += " "; } } } return name; } }
Inflector { public static String humanize(final String camelCased) { String name = ""; for (final Iterator<String> i = split(camelCased).iterator(); i.hasNext();) { String part = capitalize(i.next().toLowerCase()); if (!part.isEmpty()) { name += part; if (i.hasNext()) { name += " "; } } } return name; } private  Inflector(); }
Inflector { public static String humanize(final String camelCased) { String name = ""; for (final Iterator<String> i = split(camelCased).iterator(); i.hasNext();) { String part = capitalize(i.next().toLowerCase()); if (!part.isEmpty()) { name += part; if (i.hasNext()) { name += " "; } } } return name; } private  Inflector(); static String humanize(final String camelCased); static String camelize(final String humanCased); }
Inflector { public static String humanize(final String camelCased) { String name = ""; for (final Iterator<String> i = split(camelCased).iterator(); i.hasNext();) { String part = capitalize(i.next().toLowerCase()); if (!part.isEmpty()) { name += part; if (i.hasNext()) { name += " "; } } } return name; } private  Inflector(); static String humanize(final String camelCased); static String camelize(final String humanCased);  }