public class StringUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.List<java.lang.String> |
ESCAPED_CHARACTERS |
static java.lang.String |
LOWER_CHARS |
static java.lang.String |
NUMBER_CHARS |
static java.lang.String |
SPECIAL_CHARS |
static java.lang.String |
UPPER_CHARS |
| Constructor and Description |
|---|
StringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
contains(java.lang.String string,
java.lang.String sequence)
Checks if a string contains another string, ignoring case sensitivity.
|
static boolean |
endsWith(java.lang.String string,
java.lang.String suffix)
Checks if a string ends with another string, ignoring case sensitivity.
|
static java.lang.String |
formatBytes(long value)
Formats a value in bytes to a human-readable format
|
static java.lang.String |
longestOf(java.util.List<java.lang.String> strings)
Returns the longest string of the given strings
|
static java.lang.String |
longestOf(java.lang.String... strings)
Returns the longest string of the given strings
|
static int |
maximumStringSize(int radix,
long maxValue)
Returns the size of the biggest possible string that can be used to encode a number within the given maximum value and radix.
|
static java.lang.String |
normalizeEnumName(java.lang.String string)
Normalizes the given enum name to a readable string (e.g.
|
static java.lang.String |
replaceAll(java.lang.String string,
java.lang.String sequence,
java.lang.String replacement)
Replaces all occurrences of a substring in a string, ignoring case sensitivity.
|
static java.lang.String |
replaceLast(java.lang.String string,
java.lang.String target,
java.lang.String replacement)
Replaces the last occurrence of a substring in a string with another substring.
|
static java.lang.String |
reverse(java.lang.String string)
Reverses the given string
|
static java.lang.String |
smallestOf(java.util.List<java.lang.String> strings)
Returns the smallest string of the given strings
|
static java.lang.String |
smallestOf(java.lang.String... strings)
Returns the smallest string of the given strings
|
static java.lang.String |
space(int count)
Generates a string of spaces
|
static boolean |
startsWith(java.lang.String input,
java.lang.String prefix)
Checks if a string starts with another string, ignoring case sensitivity.
|
static java.lang.String |
uppercaseFirst(java.lang.String string)
Uppercase the first letter of the string.
|
static java.lang.String |
whitespace(int count)
Generates a string of whitespaces
|
public static final java.lang.String UPPER_CHARS
public static final java.lang.String LOWER_CHARS
public static final java.lang.String SPECIAL_CHARS
public static final java.lang.String NUMBER_CHARS
public static final java.util.List<java.lang.String> ESCAPED_CHARACTERS
public static java.lang.String formatBytes(long value)
value - The raw value in bytespublic static java.lang.String uppercaseFirst(java.lang.String string)
string - The string to uppercasepublic static java.lang.String reverse(java.lang.String string)
string - The string to reversepublic static java.lang.String whitespace(int count)
count - The count of whitespacespublic static java.lang.String space(int count)
count - The count of spacespublic static java.lang.String longestOf(java.util.List<java.lang.String> strings)
strings - The strings to checkpublic static java.lang.String longestOf(java.lang.String... strings)
strings - The strings to checkpublic static java.lang.String smallestOf(java.util.List<java.lang.String> strings)
strings - The strings to checkpublic static java.lang.String smallestOf(java.lang.String... strings)
strings - The strings to checkpublic static java.lang.String normalizeEnumName(java.lang.String string)
string - The name to normalizepublic static java.lang.String replaceLast(java.lang.String string,
java.lang.String target,
java.lang.String replacement)
string - The input string.target - The substring to be replaced.replacement - The substring to replace the last occurrence of the target.public static java.lang.String replaceAll(java.lang.String string,
java.lang.String sequence,
java.lang.String replacement)
string - The input string.sequence - The substring to be replaced.replacement - The substring to replace all occurrences of the target.public static boolean contains(java.lang.String string,
java.lang.String sequence)
string - The input string.sequence - The string to check for containment.public static boolean endsWith(java.lang.String string,
java.lang.String suffix)
string - The input string.suffix - The string to check for at the end.public static boolean startsWith(java.lang.String input,
java.lang.String prefix)
input - The input string.prefix - The string to check for at the beginning.public static int maximumStringSize(int radix,
long maxValue)
radix - The radix (base) to be used for encoding the number. Must be greater than 1.maxValue - The maximum value that needs to be encoded. Must be a non-negative integer.