@Test public void testNullSlug() { String in = null; String result = Slugs.toSlug(in); String expected = null; assertEquals(expected, result); }
public static String toSlug(String text) { if (null == text) { return null; } Matcher m = pattern.matcher(text); String result = m.replaceAll("-"); if (result.endsWith("-")) { result = result.substring(0, result.length() - 1); } return result.toLowerCase(); }
Slugs { public static String toSlug(String text) { if (null == text) { return null; } Matcher m = pattern.matcher(text); String result = m.replaceAll("-"); if (result.endsWith("-")) { result = result.substring(0, result.length() - 1); } return result.toLowerCase(); } }
Slugs { public static String toSlug(String text) { if (null == text) { return null; } Matcher m = pattern.matcher(text); String result = m.replaceAll("-"); if (result.endsWith("-")) { result = result.substring(0, result.length() - 1); } return result.toLowerCase(); }  }
Slugs { public static String toSlug(String text) { if (null == text) { return null; } Matcher m = pattern.matcher(text); String result = m.replaceAll("-"); if (result.endsWith("-")) { result = result.substring(0, result.length() - 1); } return result.toLowerCase(); }  static String toSlug(String text); }
Slugs { public static String toSlug(String text) { if (null == text) { return null; } Matcher m = pattern.matcher(text); String result = m.replaceAll("-"); if (result.endsWith("-")) { result = result.substring(0, result.length() - 1); } return result.toLowerCase(); }  static String toSlug(String text);  }