|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.buildforge.services.common.text.TextUtils
public class TextUtils
Some text formatting and covnersion utilities.
Method Summary | ||
---|---|---|
static java.lang.StringBuilder |
appendFixed(java.lang.StringBuilder sb,
java.lang.String s,
int width)
Forces a string to an exact length. |
|
static java.lang.String |
bf_encrypt(java.lang.String pt)
Java implementation of the bf_encrypt algorithm. |
|
static java.lang.String |
fixedHex(long value,
int width)
Represents an integer value as hex and pads it to be at least the requested number of hex digits. |
|
static boolean |
isEmpty(java.lang.String s)
Convenient test for either null or empty string. |
|
static java.lang.String |
join(char delim,
java.lang.String... args)
Joins a list of strings together using the specified delimiter. |
|
static java.lang.String[] |
split(java.lang.String s,
char delim)
Splits a string into substrings using the specified delimiter. |
|
static boolean |
toBoolean(java.lang.Object value,
boolean def)
|
|
static boolean |
toBoolean(java.lang.String value,
boolean def)
|
|
static char |
toChar(java.lang.Object value,
char def)
Safely converts an arbitrary object to a char. |
|
static char |
toChar(java.lang.String value,
char def)
Safely converts a string to a char. |
|
static java.util.Date |
toDate(java.lang.Object value)
|
|
static java.util.Date |
toDate(java.lang.String value)
|
|
static double |
toDouble(java.lang.Object value,
double def)
Safely converts an arbitrary object to a double. |
|
static double |
toDouble(java.lang.String value,
double def)
Safely converts a string to a double. |
|
static
|
toEnum(java.lang.Class<E> cls,
java.lang.Object value)
|
|
static
|
toEnum(java.lang.Class<E> cls,
java.lang.String value)
|
|
static int |
toInt(java.lang.Object value,
int def)
Safely converts an arbitrary object to an integer. |
|
static int |
toInt(java.lang.String value,
int def)
Safely converts a string to an integer. |
|
static long |
toLong(java.lang.Object value,
long def)
Safely converts an arbitrary object to a long. |
|
static long |
toLong(java.lang.String value,
long def)
Safely converts a string to a long. |
|
static java.lang.String |
toString(java.lang.Object value,
java.lang.String def)
|
|
static java.lang.String |
toString(java.lang.String value,
java.lang.String def)
|
|
static int |
toTimestamp(java.lang.Object value)
|
|
static int |
toTimestamp(java.lang.String value)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final boolean isEmpty(java.lang.String s)
s
- the string to test
public static java.lang.String[] split(java.lang.String s, char delim)
s
- the string to split, or nulldelim
- the delimiter character
public static java.lang.String join(char delim, java.lang.String... args)
delim
- the delimiterargs
- the strings to join together, or null
public static java.lang.String fixedHex(long value, int width)
value
- the value to represent as hexwidth
- the width to use
public static java.lang.StringBuilder appendFixed(java.lang.StringBuilder sb, java.lang.String s, int width)
sb
- the string buffer to add this string to the end ofs
- the string to be paddedwidth
- the desired width, or the negative of the desired
width for left-padding instead of right-padding.
public static java.lang.String bf_encrypt(java.lang.String pt) throws APIException
pt
- the plaintext
APIException
- if the plaintext is too longpublic static int toInt(java.lang.Object value, int def)
value
- the value to convert (may be null)def
- the value to use when value is null or
cannot be parsed to the desired format
public static int toInt(java.lang.String value, int def)
value
- the value to convert (may be null)def
- the value to use when value is null or
cannot be parsed to the desired format
public static long toLong(java.lang.Object value, long def)
value
- the value to convert (may be null)def
- the value to use when value is null or
cannot be parsed to the desired format
public static long toLong(java.lang.String value, long def)
value
- the value to convert (may be null)def
- the value to use when value is null or
cannot be parsed to the desired format
public static double toDouble(java.lang.Object value, double def)
value
- the value to convert (may be null)def
- the value to use when value is null or
cannot be parsed to the desired format
public static double toDouble(java.lang.String value, double def)
value
- the value to convert (may be null)def
- the value to use when value is null or
cannot be parsed to the desired format
public static char toChar(java.lang.Object value, char def)
value
- the value to convert (may be null)def
- the value to use when value is null or
cannot be parsed to the desired format
public static char toChar(java.lang.String value, char def)
value
- the value to convert (may be null)def
- the value to use when value is null or
cannot be parsed to the desired format
public static boolean toBoolean(java.lang.Object value, boolean def)
public static boolean toBoolean(java.lang.String value, boolean def)
public static java.lang.String toString(java.lang.String value, java.lang.String def)
public static java.lang.String toString(java.lang.Object value, java.lang.String def)
public static <E extends java.lang.Enum<E>> E toEnum(java.lang.Class<E> cls, java.lang.Object value) throws APIException
APIException
public static <E extends java.lang.Enum<E>> E toEnum(java.lang.Class<E> cls, java.lang.String value) throws APIException
APIException
public static java.util.Date toDate(java.lang.String value)
public static java.util.Date toDate(java.lang.Object value)
public static int toTimestamp(java.lang.String value)
public static int toTimestamp(java.lang.Object value)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |