Package org.pf4j.util
Class StringUtils
java.lang.Object
org.pf4j.util.StringUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Adds a substring only if the source string does not already start with the substring, otherwise returns the source string.static String
Format the string.static boolean
isNotNullOrEmpty
(String str) static boolean
isNullOrEmpty
(String str)
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
isNullOrEmpty
-
isNotNullOrEmpty
-
format
Format the string. Replace "{}" with %s and format the string usingString.format(String, Object...)
. -
addStart
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
-