| java.lang.Object org.apache.tools.ant.util.StringUtils
StringUtils | final public class StringUtils (Code) | | A set of helper methods related to string manipulation.
|
Method Summary | |
public static boolean | endsWith(StringBuffer buffer, String suffix) Checks that a string buffer ends up with a given string. | public static String | getStackTrace(Throwable t) Convenient method to retrieve the full stacktrace from a given exception.
Parameters: t - the exception to get the stacktrace from. | public static Vector | lineSplit(String data) Splits up a string into a list of lines. | public static long | parseHumanSizes(String humanSize) Takes a human readable size representation eg 10K
a long value. | public static String | replace(String data, String from, String to) Replace occurrences into a string.
Parameters: data - the string to replace occurrences into Parameters: from - the occurrence to replace. Parameters: to - the occurrence to be used as a replacement. | public static String | resolveBackSlash(String input) xml does not do "c" like interpretation of strings.
i.e. | public static Vector | split(String data, int ch) Splits up a string where elements are separated by a specific
character and return all elements.
Parameters: data - the string to split up. Parameters: ch - the separator character. |
LINE_SEP | final public static String LINE_SEP(Code) | | the line separator for this OS
|
endsWith | public static boolean endsWith(StringBuffer buffer, String suffix)(Code) | | Checks that a string buffer ends up with a given string. It may sound
trivial with the existing
JDK API but the various implementation among JDKs can make those
methods extremely resource intensive
and perform poorly due to massive memory allocation and copying. See
Parameters: buffer - the buffer to perform the check on Parameters: suffix - the suffix true if the character sequence represented by theargument is a suffix of the character sequence represented bythe StringBuffer object; false otherwise. Note that theresult will be true if the argument is theempty string. |
getStackTrace | public static String getStackTrace(Throwable t)(Code) | | Convenient method to retrieve the full stacktrace from a given exception.
Parameters: t - the exception to get the stacktrace from. the stacktrace from the given exception. |
lineSplit | public static Vector lineSplit(String data)(Code) | | Splits up a string into a list of lines. It is equivalent
to split(data, '\n').
Parameters: data - the string to split up into lines. the list of lines available in the string. |
parseHumanSizes | public static long parseHumanSizes(String humanSize) throws Exception(Code) | | Takes a human readable size representation eg 10K
a long value. Doesn't support 1.1K or other rational values.
Parameters: humanSize - a long value representation throws: Exception - since: Ant 1.7 |
replace | public static String replace(String data, String from, String to)(Code) | | Replace occurrences into a string.
Parameters: data - the string to replace occurrences into Parameters: from - the occurrence to replace. Parameters: to - the occurrence to be used as a replacement. the new string with replaced occurrences. |
resolveBackSlash | public static String resolveBackSlash(String input)(Code) | | xml does not do "c" like interpretation of strings.
i.e. \n\r\t etc.
this method processes \n, \r, \t, \f, \\
also subs \s -> " \n\r\t\f"
a trailing '\' will be ignored
Parameters: input - raw string with possible embedded '\'s converted string since: Ant 1.7 |
split | public static Vector split(String data, int ch)(Code) | | Splits up a string where elements are separated by a specific
character and return all elements.
Parameters: data - the string to split up. Parameters: ch - the separator character. the list of elements. |
|
|