public final class StringUtil
extends java.lang.Object
| Constructor and Description |
|---|
StringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
arrayToStringByte(byte[] array)
Creates a String from an array of byte.
|
static java.lang.String |
arrayToStringInt(int[] array)
Creates a String from an array of int.
|
static java.lang.String |
arrayToStringLong(long[] array)
Creates a String form a array of long.
|
static java.lang.String |
chomp(java.lang.String inStr)
Deletes the Line Feed (10) and Carriage Return (13) fields of the given String.
|
static java.lang.String |
decodeURL(java.lang.String url)
Decodes a String in
application/x-www-form-urlencoded format as specified in Chapter Forms of the
HTML 4.01 Specification. |
static java.lang.String |
decodeURL(java.lang.String url,
java.lang.String encoding)
Decodes a String in
application/x-www-form-urlencoded format as specified in Chapter Forms of the
HTML 4.01 Specification. |
static java.lang.String |
encodeStringForURL(java.lang.String str)
Encodes a String for use in an URL.
|
static boolean |
equalsIgnoreCase(java.lang.String s1,
java.lang.String s2) |
static java.lang.String |
formatClassName(java.lang.Class clazz)
Depending on the value of
USE_LONG_CLASS_NAMES returns either the fully qualified
class name of clazz or the result of calling simpleClassName(Class) on
it. |
static java.lang.String |
formatClassName(java.lang.String qualifiedClassName)
Depending on the value of
USE_LONG_CLASS_NAMES returns either the same String given in
argument qualifiedClassName or the result of calling simpleClassName(String) on it. |
static java.lang.String |
getHTTPDate(long date) |
static long |
getHTTPDateAsLong(java.lang.String httpDate) |
static java.lang.String |
getStringEncoding() |
static boolean |
isEmpty(java.lang.String s) |
static int |
lastIndexOf(java.lang.String what,
java.lang.String within) |
static HashMap |
parseStringOptions(java.lang.String args)
Parses options from a
String. |
static HashMap |
parseStringProperties(java.lang.String args)
Parses properties from a
String. |
static void |
printStream(java.io.InputStream in)
Prints a stream to System.out.
|
static java.lang.String |
simpleClassName(java.lang.Class clazz)
Returns only the substring after the last dot character ("e;."e;), within the name of
clazz, i.e. |
static java.lang.String |
simpleClassName(java.lang.String qualifiedClassName)
Given a fully qualified class name (like
java.lang.Object), returns only the
substring after the last dot character ("e;."e;), i.e. |
static java.lang.String[] |
split(java.lang.String s,
char c)
Splits a string at a given separator char in substrings and returns these elements in a string
array.
|
static java.lang.String[] |
split(java.lang.String s,
java.lang.String separator)
Splits a string at a given separator char in substrings and returns these elements in a string
array.
|
static java.lang.String[] |
splitAtWhitespace(java.lang.String s) |
static java.util.Vector |
stringToVector(java.lang.String s,
java.lang.String separator)
Converts text with spaces into
Vector. |
static java.lang.String[] |
toStringArray(java.util.Vector strings)
Converts the given Vector to String array
|
static java.lang.String |
vectorToString(java.util.Vector v,
java.lang.String separator)
Concats the elements of a vector to a string (calls toString of each element) separated by
given string.
|
public static boolean isEmpty(java.lang.String s)
public static boolean equalsIgnoreCase(java.lang.String s1,
java.lang.String s2)
public static int lastIndexOf(java.lang.String what,
java.lang.String within)
public static final java.lang.String getStringEncoding()
public static java.lang.String[] split(java.lang.String s,
char c)
s - The string to split.c - The separator char.public static java.lang.String[] split(java.lang.String s,
java.lang.String separator)
s - The string to split.separator - The separator char.public static java.lang.String[] splitAtWhitespace(java.lang.String s)
public static java.util.Vector stringToVector(java.lang.String s,
java.lang.String separator)
Vector.s - The text to convert.Vector containing the text parts.public static java.lang.String vectorToString(java.util.Vector v,
java.lang.String separator)
v - Vector to work on.separator - The string which should be used as separator.public static java.lang.String encodeStringForURL(java.lang.String str)
str - a String.public static java.lang.String decodeURL(java.lang.String url)
application/x-www-form-urlencoded format as specified in Chapter Forms of the
HTML 4.01 Specification. Uses default character encoding.url - String to decode.java.io.UnsupportedEncodingExceptionpublic static java.lang.String decodeURL(java.lang.String url,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
application/x-www-form-urlencoded format as specified in Chapter Forms of the
HTML 4.01 Specification.url - String to decode.encoding - Encoding.java.io.UnsupportedEncodingExceptionpublic static java.lang.String formatClassName(java.lang.Class clazz)
USE_LONG_CLASS_NAMES returns either the fully qualified
class name of clazz or the result of calling simpleClassName(Class) on
it.clazz - the class to return a formatted name ofclazzUSE_LONG_CLASS_NAMES,
simpleClassName(Class)public static java.lang.String formatClassName(java.lang.String qualifiedClassName)
USE_LONG_CLASS_NAMES returns either the same String given in
argument qualifiedClassName or the result of calling simpleClassName(String) on it.qualifiedClassName - a fully qualified Java class namequalifiedClassName or the simple class nameUSE_LONG_CLASS_NAMES,
simpleClassName(String)public static java.lang.String simpleClassName(java.lang.Class clazz)
clazz, i.e. Object instead of java.lang.Object.clazz - the class to return the simple name ofpublic static java.lang.String simpleClassName(java.lang.String qualifiedClassName)
java.lang.Object), returns only the
substring after the last dot character ("e;."e;), i.e. Object instead of
java.lang.Object.qualifiedClassName - a fully qualified Java class namepublic static java.lang.String[] toStringArray(java.util.Vector strings)
strings - The Vector to convert.public static java.lang.String chomp(java.lang.String inStr)
inStr - The String to work on.public static HashMap parseStringOptions(java.lang.String args)
String. The options are defined as "-name args - the String to parse the options from.Map containing the options properties.public static HashMap parseStringProperties(java.lang.String args)
String. The properties are defined as "name=value" pairs
divided by a blank.args - the String to parse the properties from.Map containing the properties.public static void printStream(java.io.InputStream in)
in - the stream to print.public static java.lang.String arrayToStringInt(int[] array)
array - the array to show.public static java.lang.String arrayToStringByte(byte[] array)
array - the array to show.public static java.lang.String arrayToStringLong(long[] array)
array - the array to show.public static long getHTTPDateAsLong(java.lang.String httpDate)
public static java.lang.String getHTTPDate(long date)