Package wbs.utils.util.string
Class WbsStrings
java.lang.Object
wbs.utils.util.string.WbsStrings
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddColourGradient(String string, org.bukkit.Color startColour, org.bukkit.Color endColour) static StringaddColourGradient(String string, org.bukkit.Color startColour, org.bukkit.Color endColour, boolean colourise) static Stringcapitalize(@NotNull String str) Capitalize the first letter a stringstatic StringcapitalizeAll(String str) Capitalize all words in a string, separated by spacesstatic Stringstatic StringcombineFirst(String[] strings, int length) static StringcombineFirst(String[] strings, int length, String delimiter) static StringcombineLast(String[] strings, int index) Combine the final elements of a string array starting at a specified indexstatic StringcombineLast(String[] strings, int index, String delimiter) filterStartsWith(Collection<String> choices, String filter) Filter a collection of strings by those that start with the given stringstatic StringgetInvisibleString(String original) Get a string that, when rendered in minecraft, will be invisible.static StringgetLineWith(String find, Collection<String> in) Get the first string in a Collection that contains another string.getNextNodes(String current, Collection<String> options) getNextNodes(String current, Collection<String> options, String delimiter) static StringrevealString(String invisibleString) Reveal a string concealed bygetInvisibleString(String)static StringundoColourText(String colouredText)
-
Method Details
-
capitalizeAll
Capitalize all words in a string, separated by spaces- Parameters:
str- The string to process- Returns:
- The string with all words capitalized
-
capitalize
Capitalize the first letter a string- Parameters:
str- The string to capitalize- Returns:
- The capitalized string
-
getLineWith
Get the first string in a Collection that contains another string.- Parameters:
find- The string to findin- The Collection to search for the string in- Returns:
- The full string that contains the find parameter. null if the Collection does not contain a string that contains find.
-
getInvisibleString
Get a string that, when rendered in minecraft, will be invisible.- Parameters:
original- The string to hide- Returns:
- The string that will render invisibly in game.
-
colourise
-
revealString
Reveal a string concealed bygetInvisibleString(String)- Parameters:
invisibleString- An "invisible" string created bygetInvisibleString(String)- Returns:
- The original string
-
combineLast
Combine the final elements of a string array starting at a specified index- Parameters:
strings- The array of Strings to combineindex- The index to start combining at- Returns:
- A single String containing all entries in {strings} split with " ", excluding the first {index} entries
-
combineLast
-
getNextNodes
-
getNextNodes
-
combineFirst
-
combineFirst
-
undoColourText
-
addColourGradient
-
addColourGradient
-
filterStartsWith
Filter a collection of strings by those that start with the given string- Parameters:
choices- The collection to filterfilter- The string to check startsWith- Returns:
- A list of strings that contains only elements of choices that start with the filter string, ignoring case
-