@Test public void testCanonicalizeLeavesDigits() { String input = "Project#$%--- Name99"; String expected = "project-name99"; String actual = Strings.canonicalize(input); assertEquals(expected, actual); }
public static String canonicalize(final String name) { String result = null; if (name != null) { result = name.toLowerCase().replace(' ', '-').replaceAll("[^a-z0-9-]*", "").replaceAll("-+", "-"); } return result; }
Strings { public static String canonicalize(final String name) { String result = null; if (name != null) { result = name.toLowerCase().replace(' ', '-').replaceAll("[^a-z0-9-]*", "").replaceAll("-+", "-"); } return result; } }
Strings { public static String canonicalize(final String name) { String result = null; if (name != null) { result = name.toLowerCase().replace(' ', '-').replaceAll("[^a-z0-9-]*", "").replaceAll("-+", "-"); } return result; }  }
Strings { public static String canonicalize(final String name) { String result = null; if (name != null) { result = name.toLowerCase().replace(' ', '-').replaceAll("[^a-z0-9-]*", "").replaceAll("-+", "-"); } return result; }  static String camelToUnderscore(final String input); static String join(final String delim, final String... strings); static String canonicalize(final String name); }
Strings { public static String canonicalize(final String name) { String result = null; if (name != null) { result = name.toLowerCase().replace(' ', '-').replaceAll("[^a-z0-9-]*", "").replaceAll("-+", "-"); } return result; }  static String camelToUnderscore(final String input); static String join(final String delim, final String... strings); static String canonicalize(final String name);  }