@Test public void formatPlainTextToId() { assertEquals(IDUtils.formatId(" Hello World "), "hello-world"); assertEquals(IDUtils.formatId("He!l@ W#Rld"), "hel-wrld"); assertEquals(IDUtils.formatId("HELLO-__-WORLD"), "hello-world"); assertEquals(IDUtils.formatId(" HELLO WORLD "), "hello-world"); }
public static String formatId(String toFormat) { return toFormat.toLowerCase().replaceAll("[-_]", " ") .replaceAll("[^A-Za-z0-9\\s]", "").trim().replaceAll("\\s+", "-"); }
IDUtils { public static String formatId(String toFormat) { return toFormat.toLowerCase().replaceAll("[-_]", " ") .replaceAll("[^A-Za-z0-9\\s]", "").trim().replaceAll("\\s+", "-"); } }
IDUtils { public static String formatId(String toFormat) { return toFormat.toLowerCase().replaceAll("[-_]", " ") .replaceAll("[^A-Za-z0-9\\s]", "").trim().replaceAll("\\s+", "-"); }  }
IDUtils { public static String formatId(String toFormat) { return toFormat.toLowerCase().replaceAll("[-_]", " ") .replaceAll("[^A-Za-z0-9\\s]", "").trim().replaceAll("\\s+", "-"); }  static String formatId(String toFormat); static String randomUUID(); }
IDUtils { public static String formatId(String toFormat) { return toFormat.toLowerCase().replaceAll("[-_]", " ") .replaceAll("[^A-Za-z0-9\\s]", "").trim().replaceAll("\\s+", "-"); }  static String formatId(String toFormat); static String randomUUID();  }