public class StringUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PADDING_SYMBOL |
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
bytesOf(java.lang.CharSequence str) |
static java.lang.String |
cleanString(java.lang.String s) |
static java.lang.String |
expandPath(java.lang.String path)
Expand ~ to user.home
|
static java.lang.String |
fixedLength(java.lang.String s,
int length) |
static boolean |
isNullOrEmpty(BufferedString s) |
static boolean |
isNullOrEmpty(java.lang.String s)
Convenience function to test whether a string is empty.
|
static java.lang.String |
join(java.lang.String delimiter,
java.lang.Iterable<java.lang.String> strings)
Join the array with the given delimiter, and return it as a string.
|
static java.lang.String |
join(java.lang.String delimiter,
java.lang.String[] arr)
Join the array with the given delimiter, and return it as a string.
|
static java.lang.String |
sanitizeIdentifier(java.lang.String id) |
static java.util.ArrayList<int[]> |
texts2array(java.util.List<java.lang.String> texts) |
static byte[] |
toBytes(java.lang.Object value) |
static java.lang.Character[] |
toCharacterArray(java.lang.String src) |
static java.util.HashSet<java.lang.Character> |
toCharacterSet(java.lang.String src)
Convert a string into the set of its characters.
|
static java.lang.String[] |
tokenize(java.lang.String text) |
static int[] |
tokensToArray(java.lang.String[] tokens,
int padToLength,
java.util.Map<java.lang.String,java.lang.Integer> dict) |
static java.lang.String |
toString(byte[] bytes,
int from,
int length) |
static java.lang.String |
toString(java.lang.Throwable t)
Print exception stack trace into a string.
|
static int |
unhex(java.lang.String str) |
public static java.lang.String toString(java.lang.Throwable t)
t
- an exceptionpublic static boolean isNullOrEmpty(java.lang.String s)
s
- String to testpublic static boolean isNullOrEmpty(BufferedString s)
public static java.lang.String expandPath(java.lang.String path)
path
- that can (but doesn't have to) contain a tilde (~)public static java.lang.String cleanString(java.lang.String s)
public static java.lang.String[] tokenize(java.lang.String text)
public static int[] tokensToArray(java.lang.String[] tokens, int padToLength, java.util.Map<java.lang.String,java.lang.Integer> dict)
public static java.util.ArrayList<int[]> texts2array(java.util.List<java.lang.String> texts)
public static java.lang.String join(java.lang.String delimiter, java.lang.String[] arr)
delimiter
- string to be used as a separator between array elementsarr
- the array to joinpublic static java.lang.String join(java.lang.String delimiter, java.lang.Iterable<java.lang.String> strings)
delimiter
- string to be used as a separator between array elementsstrings
- the strings to joinpublic static java.util.HashSet<java.lang.Character> toCharacterSet(java.lang.String src)
src
- Source stringpublic static java.lang.Character[] toCharacterArray(java.lang.String src)
public static int unhex(java.lang.String str)
public static byte[] bytesOf(java.lang.CharSequence str)
public static byte[] toBytes(java.lang.Object value)
public static java.lang.String toString(byte[] bytes, int from, int length)
public static java.lang.String sanitizeIdentifier(java.lang.String id)
public static java.lang.String fixedLength(java.lang.String s, int length)