Class StringUtil
java.lang.Object
com.seibel.distanthorizons.coreapi.util.StringUtil
Miscellaneous string helper functions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
byteArrayToHexString
(byte[] bytes) Converts the given byte array into a hex string representation.static String
convertBytesToHumanReadable
(long bytes) Source: https://stackoverflow.com/questions/3758606/how-can-i-convert-byte-size-into-a-human-readable-format-in-java#3758880static <T> String
Combines each item in the given list together separated by the given delimiter.static <T> String
static int
nthIndexOf
(String str, String substr, int n) Returns the n-th index of the given string.static String
shortenString
(String str, int maxLength) Returns a shortened version of the given string that is no longer than maxLength.
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
nthIndexOf
Returns the n-th index of the given string.
Original source: https://stackoverflow.com/questions/3976616/how-to-find-nth-occurrence-of-character-in-a-string -
join
- See Also:
-
join
Combines each item in the given list together separated by the given delimiter. -
byteArrayToHexString
Converts the given byte array into a hex string representation.
source: https://stackoverflow.com/a/9855338 -
shortenString
Returns a shortened version of the given string that is no longer than maxLength.
If null returns the empty string. -
convertBytesToHumanReadable
Source: https://stackoverflow.com/questions/3758606/how-can-i-convert-byte-size-into-a-human-readable-format-in-java#3758880
-