public final class StringUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
LINE_SEP
the line separator for this OS
|
Modifier and Type | Method and Description |
---|---|
static boolean |
endsWith(StringBuffer buffer,
String suffix)
Checks that a string buffer ends up with a given string.
|
static String |
getStackTrace(Throwable t)
Convenient method to retrieve the full stacktrace from a given exception.
|
static Vector<String> |
lineSplit(String data)
Splits up a string into a list of lines.
|
static long |
parseHumanSizes(String humanSize)
Takes a human readable size representation eg 10K
a long value.
|
static String |
removePrefix(String string,
String prefix)
Removes the prefix from a given string, if the string contains
that prefix.
|
static String |
removeSuffix(String string,
String suffix)
Removes the suffix from a given string, if the string contains
that suffix.
|
static String |
resolveBackSlash(String input)
xml does not do "c" like interpretation of strings.
|
static Vector<String> |
split(String data,
int ch)
Splits up a string where elements are separated by a specific
character and return all elements.
|
public static final String LINE_SEP
public static boolean endsWith(StringBuffer buffer, String suffix)
buffer
- the buffer to perform the check onsuffix
- the suffixtrue
if the character sequence represented by the
argument is a suffix of the character sequence represented by
the StringBuffer object; false
otherwise. Note that the
result will be true
if the argument is the
empty string.public static String getStackTrace(Throwable t)
t
- the exception to get the stacktrace from.public static Vector<String> lineSplit(String data)
data
- the string to split up into lines.public static long parseHumanSizes(String humanSize) throws Exception
humanSize
- the amount as a human readable string.Exception
- if there is a problem.public static String removePrefix(String string, String prefix)
string
- String for checkprefix
- Prefix to removepublic static String removeSuffix(String string, String suffix)
string
- String for checksuffix
- Suffix to removepublic static String resolveBackSlash(String input)
input
- raw string with possible embedded '\'s