public final class StringUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LINE_SEP
the line separator for this OS
|
Modifier and Type | Method and Description |
---|---|
static boolean |
endsWith(java.lang.StringBuffer buffer,
java.lang.String suffix)
Checks that a string buffer ends up with a given string.
|
static java.lang.String |
getStackTrace(java.lang.Throwable t)
Convenient method to retrieve the full stacktrace from a given exception.
|
static java.util.Vector<java.lang.String> |
lineSplit(java.lang.String data)
Splits up a string into a list of lines.
|
static long |
parseHumanSizes(java.lang.String humanSize)
Takes a human readable size representation eg 10K
a long value.
|
static java.lang.String |
removePrefix(java.lang.String string,
java.lang.String prefix)
Removes the prefix from a given string, if the string contains
that prefix.
|
static java.lang.String |
removeSuffix(java.lang.String string,
java.lang.String suffix)
Removes the suffix from a given string, if the string contains
that suffix.
|
static java.lang.String |
replace(java.lang.String data,
java.lang.String from,
java.lang.String to)
Deprecated.
Use
String.replace(CharSequence, CharSequence) now. |
static java.lang.String |
resolveBackSlash(java.lang.String input)
xml does not do "c" like interpretation of strings.
|
static java.util.Vector<java.lang.String> |
split(java.lang.String data,
int ch)
Splits up a string where elements are separated by a specific
character and return all elements.
|
public static java.util.Vector<java.lang.String> lineSplit(java.lang.String data)
data
- the string to split up into lines.public static java.util.Vector<java.lang.String> split(java.lang.String data, int ch)
data
- the string to split up.ch
- the separator character.@Deprecated public static java.lang.String replace(java.lang.String data, java.lang.String from, java.lang.String to)
String.replace(CharSequence, CharSequence)
now.data
- the string to replace occurrences intofrom
- the occurrence to replace.to
- the occurrence to be used as a replacement.public static java.lang.String getStackTrace(java.lang.Throwable t)
t
- the exception to get the stacktrace from.public static boolean endsWith(java.lang.StringBuffer buffer, java.lang.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 java.lang.String resolveBackSlash(java.lang.String input)
input
- raw string with possible embedded '\'spublic static long parseHumanSizes(java.lang.String humanSize) throws java.lang.Exception
humanSize
- the amount as a human readable string.java.lang.Exception
- if there is a problem.public static java.lang.String removeSuffix(java.lang.String string, java.lang.String suffix)
string
- String for checksuffix
- Suffix to removepublic static java.lang.String removePrefix(java.lang.String string, java.lang.String prefix)
string
- String for checkprefix
- Prefix to remove