public class StringUtils
extends java.lang.Object
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isNullOrEmpty(java.lang.String string) |
static ArrayList<java.lang.String> |
split(java.lang.String string,
char delimiter)
Splits this string using the supplied character as the delimiter.
|
static ArrayList<java.lang.String> |
split(java.lang.String string,
char delimiter,
int max)
Splits this string using the supplied character as the delimiter, returning at most
max items. |
static ArrayList<java.lang.String> |
split(java.lang.String string,
Pattern delimiter)
Splits this string using the supplied pattern as the delimiter.
|
static ArrayList<java.lang.String> |
split(java.lang.String string,
Pattern delimiter,
int max)
Splits this string using the supplied pattern as the delimiter.
|
static byte |
toByteFromHexCharacter(char hexCharacter)
Convert a hex character to it's equivalent byte.
|
static byte[] |
toBytesFromHexString(java.lang.String hexString)
Convert a hexadecimal string to a byte array.
|
static java.lang.String |
toHexStringFromBytes(byte[] bytes)
Convert a byte array to a hexadecimal string.
|
static byte[] |
toLatin1BytesFromString(java.lang.String string)
Convert a string, assumed to contain only Latin1 (aka 8859-1 aka Windows 1252) characters, to a byte array.
|
static java.lang.String |
toStringFromLatin1Bytes(byte[] bytes)
Convert a byte array, assumed to be a Latin1 (aka 8859-1 aka Windows 1252) encoded string, to a regular Java
string.
|
static java.lang.String |
toStringFromLatin1Bytes(ByteArrayRange byteArrayRange)
Convert a ByteArrayRange, assumed to be a Latin1 (aka 8859-1 aka Windows 1252) encoded string, to a regular Java
string.
|
public static boolean isNullOrEmpty(@Nullable java.lang.String string)
public static java.lang.String toHexStringFromBytes(byte[] bytes)
bytes
- byte arraypublic static byte[] toBytesFromHexString(java.lang.String hexString)
hexString
- hex string, containing only 0-9, A-F, or a-fpublic static byte toByteFromHexCharacter(char hexCharacter)
hexCharacter
- hex character (0-9, A-F, or a-f)public static java.lang.String toStringFromLatin1Bytes(byte[] bytes)
bytes
- byte arraypublic static java.lang.String toStringFromLatin1Bytes(ByteArrayRange byteArrayRange)
byteArrayRange
- byte array datapublic static byte[] toLatin1BytesFromString(java.lang.String string)
string
- input string, which should contain only Latin1 characterspublic static ArrayList<java.lang.String> split(java.lang.String string, Pattern delimiter)
string
- string to splitdelimiter
- the pattern used to delimit substringspublic static ArrayList<java.lang.String> split(java.lang.String string, Pattern delimiter, int max)
delimiter
pattern
is character or literal string, but it can be arbitrarily complex.
The parameter max
controls how many times the pattern is applied, by specifying the max number of items
in the returned list. If the limit is reached, the last item returned includes the remainder of the string.
Specify 0 for no limit.string
- string to splitdelimiter
- the pattern used to delimit substringsmax
- the max number of entries in the resulting array; if 0 then unlimitedpublic static ArrayList<java.lang.String> split(java.lang.String string, char delimiter)
string
- string to splitdelimiter
- the character used to delimit substringspublic static ArrayList<java.lang.String> split(java.lang.String string, char delimiter, int max)
max
items.string
- string to splitdelimiter
- the character used to delimit substringsmax
- the max number of entries in the resulting array; if 0 then unlimited