Package com.palmergames.util
Class StringMgmt
java.lang.Object
com.palmergames.util.StringMgmt
Useful functions related to strings, or arrays of them.
- Version:
- 1.4
- Author:
- Shade (Chris H)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
capitalize
(String str) static String
capitalizeStrings
(String string) Capitalizes the beginning of each word, accounting for underscores separating those wordsstatic boolean
containsIgnoreCase
(List<String> arr, String str) static boolean
isAllUpperCase
(@NotNull String string) static boolean
isAllUpperCase
(@NotNull Collection<String> collection) static String
static String
static String
join
(Collection<?> args) static String
join
(Collection<?> args, String separator) static String
static String
Shortens the string to fit in the specified size with an ellipse "..." at the end.static boolean
parseOnOff
(String s) static String[]
static String[]
remFirstArg
(String[] arr) static String[]
remLastArg
(String[] arr) static String
remUnderscore
(String str) Replaces underscores with spaces.static String
static String[]
static String
translateHexColors
(String string) static String
translateHexColors
(String string, Function<String, String> hexFunction) static String
trimMaxLength
(String str, int length) Shortens the string to fit in the specified size.static String
-
Field Details
-
hexPattern
-
hexReplacePattern
-
-
Constructor Details
-
StringMgmt
public StringMgmt()
-
-
Method Details
-
translateHexColors
-
translateHexColors
-
join
-
join
-
join
-
join
-
join
-
repeat
-
remFirstArg
-
remLastArg
-
remArgs
-
subArray
-
trimMaxLength
Shortens the string to fit in the specified size.- Parameters:
str
- -String
to trimlength
- - length to trim to- Returns:
- the shortened string
-
maxLength
Shortens the string to fit in the specified size with an ellipse "..." at the end.- Parameters:
str
- -String
to fitlength
- - Length of the string, before shortening- Returns:
- the shortened string, followed with ellipses
-
containsIgnoreCase
-
remUnderscore
Replaces underscores with spaces.- Parameters:
str
- - the string to change.- Returns:
- the string with spaces replacing underscores.
-
capitalize
-
capitalizeStrings
Capitalizes the beginning of each word, accounting for underscores separating those words- Parameters:
string
- String to capitalize.- Returns:
- String with the beginning letter of each word capitalized.
-
parseOnOff
- Throws:
Exception
-
isAllUpperCase
-
isAllUpperCase
-
addToList
-
wrap
-