StringLibrary { public static String firstAfterSplit(String string, Character character) { return firstAfterSplit(string, format("[%c]", character)); }  static String unique(String string); static String quoted(String string); static List<String> split(String chainedStrings, Character character); static List<String> split(String chainedStrings, String splittingRegex); static String join(Collection<String> subStrings, Character connector); static String join(Collection<String> subStrings, String connector); static String stripEnd(String string, String suffix); static String firstAfterSplit(String string, Character character); static String firstAfterSplit(String string, String splittingRegex); static String lastAfterSplit(String string, Character character); static String lastAfterSplit(String string, String splittingRegex); static String reversed(String string); static List<String> toStringList(Collection<? extends Object> objects); static List<String> toStringList(Collection<? extends Object> objects, String nullString); static Map<String, String> asStringMap(Map<K, V> sourceMap); static Map<String, V> mapWithStringKeys(Map<K, V> sourceMap); static Map<K, String> mapWithStringValues(Map<K, V> sourceMap); static int maximumToStringLength(Collection<? extends Object> objects, int lengthOfNullToString); static String rightFilled(String string, int targetLength, Character filler); static Collection<String> rightFilled(Collection<String> strings, int targetLength, Character filler); static String leftFilled(String string, int targetLength, Character filler); static Collection<String> leftFilled(Collection<String> strings, int targetLength, Character filler); static String repeated(Character character, int times); static String repeated(String text, int times); static String plainDecimalRepresentation(Number number);  }
@Test public void firstSubstringOfSplit() { String chained = "c.a.q.f.q.mq.e"; assertEquals(chained, firstAfterSplit(chained, "<")); assertEquals("c", firstAfterSplit(chained, "[.]")); assertEquals("c.a.", firstAfterSplit(chained, "q")); assertEquals("some.package.OuterClass", firstAfterSplit("some.package.OuterClass", "[$]")); assertEquals("some.package.OuterClass", firstAfterSplit("some.package.OuterClass$InnerClass", "[$]")); assertEquals("some.package.OuterClass", firstAfterSplit("some.package.OuterClass$InnerClass$InnerInnerClass", "[$]")); }