Package org.pf4j.util
Class StringUtils
- java.lang.Object
-
- org.pf4j.util.StringUtils
-
public class StringUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description StringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
addStart(java.lang.String str, java.lang.String add)
Adds a substring only if the source string does not already start with the substring, otherwise returns the source string.static java.lang.String
format(java.lang.String str, java.lang.Object... args)
Format the string.static boolean
isNotNullOrEmpty(java.lang.String str)
static boolean
isNullOrEmpty(java.lang.String str)
-
-
-
Method Detail
-
isNullOrEmpty
public static boolean isNullOrEmpty(java.lang.String str)
-
isNotNullOrEmpty
public static boolean isNotNullOrEmpty(java.lang.String str)
-
format
public static java.lang.String format(java.lang.String str, java.lang.Object... args)
Format the string. Replace "{}" with %s and format the string usingString.format(String, Object...)
.
-
addStart
public static java.lang.String addStart(java.lang.String str, java.lang.String add)
Adds a substring only if the source string does not already start with the substring, otherwise returns the source string.
A
null
source string will returnnull
. An empty ("") source string will return the empty string. Anull
search string will return the source string.StringUtils.addStart(null, *) = * StringUtils.addStart("", *) = * StringUtils.addStart(*, null) = * StringUtils.addStart("domain.com", "www.") = "www.domain.com" StringUtils.addStart("abc123", "abc") = "abc123"
- Parameters:
str
- the source String to search, may be nulladd
- the String to search for and add, may be null- Returns:
- the substring with the string added if required
-
-