StringFunctions { public static Function<Object[], String> formatterForArray(final String pattern) { return new FormatterForArrayFunction(checkNotNull(pattern, "pattern")); }  static Function<String,String> append(final String suffix); static Function<String,String> prepend(final String prefix); static Function<Object, String> formatter(final String pattern); static Function<Object[], String> formatterForArray(final String pattern); static Function<Iterable<?>, String> formatterForIterable(final String pattern); static Function<Iterable<?>, String> joiner(final String separator); static Function<Object[], String> joinerForArray(final String separator); static Function<Object,String> toStringFunction(); static Function<String,Integer> length(); static Function<String,String> surround(final String prefix, final String suffix); static Function<String, String> trim(); static Function<String, String> trimEnd(); static Function<String, String> toLowerCase(); static Function<String, String> toUpperCase(); static Function<String, String> convertCase(final CaseFormat src, final CaseFormat target);  }
@Test public static void testFormatterForArray() { Assert.assertEquals(StringFunctions.formatterForArray("Hello %s").apply(new Object[] { "World" }), "Hello World"); Assert.assertEquals(StringFunctions.formatterForArray("Hello").apply(new Object[0]), "Hello"); }
@Test public static void testFormatterForArrayMulti() { Assert.assertEquals(StringFunctions.formatterForArray("1 %s 2 %s").apply(new Object[] {"val1", "val2"}), "1 val1 2 val2"); }