Class StringUtils
java.lang.Object
me.confuser.banmanager.common.util.StringUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisValidPlayerName(String name, String additionalChars) static StringJoins the elements of the provided array into a single String containing the provided list of elements.static String[]substringsBetween(String str, String open, String close) Searches a String for substrings delimited by a start and end tag, returning all matching substrings in an array.
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
join
Joins the elements of the provided array into a single String containing the provided list of elements.
No delimiter is added before or after the list. Null objects or empty strings within the array are represented by empty strings.
StringUtils.join(null, *) = null StringUtils.join([], *) = "" StringUtils.join([null], *) = "" StringUtils.join(["a", "b", "c"], ';') = "a;b;c" StringUtils.join(["a", "b", "c"], null) = "abc" StringUtils.join([null, "", "a"], ';') = ";;a"
- Parameters:
array- the array of values to join together, may be nullseparator- the separator character to usestartIndex- the first index to start joining from. It is an error to pass in a start index past the end of the arrayendIndex- the index to stop joining from (exclusive). It is an error to pass in an end index past the end of the array- Returns:
- the joined String,
nullif null array input
-
substringsBetween
Searches a String for substrings delimited by a start and end tag, returning all matching substrings in an array.
A
nullinput String returnsnull. Anullopen/close returnsnull(no match). An empty ("") open/close returnsnull(no match).StringUtils.substringsBetween("[a][b][c]", "[", "]") = ["a","b","c"] StringUtils.substringsBetween(null, *, *) = null StringUtils.substringsBetween(*, null, *) = null StringUtils.substringsBetween(*, *, null) = null StringUtils.substringsBetween("", "[", "]") = []- Parameters:
str- the String containing the substrings, null returns null, empty returns emptyopen- the String identifying the start of the substring, empty returns nullclose- the String identifying the end of the substring, empty returns null- Returns:
- a String Array of substrings, or
nullif no match
-
isValidPlayerName
-