public class StringUtil
extends java.lang.Object
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
escapeControlCharacters(java.lang.String input)
Escapes control characters (\n, \r, \b, \t, \f).
|
static byte[] |
getModifiedUtf8Bytes(java.lang.String string)
Returns the modified UTF-8 byte array representation of the given string.
|
static int |
getModifiedUtf8Length(java.lang.String string)
Returns the length of the modified UTF-8 byte array representation of the given string.
|
static java.lang.String |
getString(byte[] modifiedUtf8Bytes)
Returns the String representation of the given modified UTF-8 byte array.
|
static java.lang.String |
getString(byte[] modifiedUtf8Bytes,
int startIndex,
int endIndex)
Returns the String representation of the given modified UTF-8 byte array.
|
static java.lang.String |
join(java.lang.String separator,
java.lang.String... strings)
Joins the given strings using the provided separator.
|
static java.lang.String |
listToString(java.util.List<java.lang.String> stringList)
Converts a List of Strings to a nicely readable format.
|
static java.lang.String |
toHexString(byte[] bytes)
Returns the hexadecimal representation of the given byte array.
|
static java.lang.String |
toHexString(byte[] bytes,
java.lang.String separator,
boolean upperCase)
Returns the hexadecimal representation of the given byte array.
|
public static int getModifiedUtf8Length(java.lang.String string)
public static byte[] getModifiedUtf8Bytes(java.lang.String string)
Note: surrogate pairs are encoded separately as three byte values as requested by the modified UTF-8 specification. This method is suited for encoding strings stored in class files, dex files or native libraries.
public static java.lang.String getString(byte[] modifiedUtf8Bytes)
public static java.lang.String getString(byte[] modifiedUtf8Bytes, int startIndex, int endIndex)
public static java.lang.String join(java.lang.String separator, java.lang.String... strings)
separator
- The separator to use.strings
- The strings to join.public static java.lang.String toHexString(byte[] bytes)
public static java.lang.String toHexString(byte[] bytes, java.lang.String separator, boolean upperCase)
public static java.lang.String escapeControlCharacters(java.lang.String input)
public static java.lang.String listToString(java.util.List<java.lang.String> stringList)