brooklyn.util.text.StringFunctions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brooklyn-utils-common Show documentation
Show all versions of brooklyn-utils-common Show documentation
Utility classes and methods developed for Brooklyn but not dependendent on Brooklyn or much else
package brooklyn.util.text;
import javax.annotation.Nullable;
import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.base.Preconditions;
public class StringFunctions {
public static Function append(final String suffix) {
return new Function() {
@Override
@Nullable
public String apply(@Nullable String input) {
if (input==null) return null;
return input + suffix;
}
};
}
/** given e.g. "hello %s" returns a function which will insert a string into that pattern */
public static Function