|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectlazyj.Format
public final class Format
Utility class providing lots of useful or less useful functions.
| Constructor Summary | |
|---|---|
Format()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
byteToHex(byte val)
Get the 2 hexa digit representation of this byte |
static java.lang.String |
decode(java.lang.String text)
Decode an URL-encoded string, using the UTF-8 charset. |
static java.lang.String |
encode(java.lang.String text)
Produce an URL encoding of the given text, using the UTF-8 charset |
static java.lang.String |
escHtml(java.lang.String text)
Transform a text into an HTML-safe string. |
static java.lang.String |
escJS(java.lang.String text)
Create a JS-safe string representation. |
static java.lang.String |
escSQL(java.lang.String text)
Create a SQL-safe version of the given text, to be embedded into SQL queries |
static java.lang.String |
extractAddress(java.lang.String address)
From a full mail address (eg. |
static java.lang.String |
extractMailTitle(java.lang.String address)
From a full mail address (eg. |
static java.lang.String |
formatBR(java.lang.String text)
Put HTML line breaks in the place of normal text line breaks. |
static java.lang.String |
formatN(java.lang.String text)
Reverse function of the formatBR(String), converts HTML line breaks into text line breaks |
static char |
hexChar(int val)
Get the hexa digit for this integer value |
static java.util.Date |
parseDate(java.lang.String s)
Transform a string that represents a Date into a real Date object. |
static java.lang.String |
point(double number)
Show a nice number, with the number of decimal places chosen automatically depending on the number to format |
static java.lang.String |
replace(java.lang.String s,
java.lang.String sWhat,
java.lang.String sWith)
Replace a sequence of text with another sequence in an original string |
static java.lang.String |
show0(int i)
For date formatting, put a "0" in front of a single digit, or leave the number as it is if there are at least two digits already |
static java.lang.String |
showDate(java.util.Date d)
Show the date and time in a nice human-readable format |
static java.lang.String |
showDottedDate(java.util.Date d)
Show a date in a dotted manner (dd.MM.yyyy) |
static java.lang.String |
showDottedDouble(double d)
Show the value in 3 digit groups separated by commas, no period point |
static java.lang.String |
showDottedDouble(double d,
int dotplaces)
Show the value in 3 digit groups separated by commas, with the specified number of decimal places after the decimal point |
static java.lang.String |
showDottedDouble(double dbl,
int decimals,
boolean aproximated)
Show the value in 3 digit groups separated by commas, with the specified number of decimal places after the decimal point. |
static java.lang.String |
showDottedLong(long l)
Show the value in 3 digit groups separated by commas |
static java.lang.String |
showLongNamedDate(java.util.Date d)
Show the full month name (11 January 2006) |
static java.lang.String |
showNamedDate(java.util.Date d)
Show the abreviated month name (11 Jan 2006) |
static java.lang.String |
showNiceDate(java.util.Date d)
Get a nifty string representation for a date. |
static java.lang.String |
showTime(java.util.Date d)
Show the time only (12:34) |
static java.lang.String |
size(long dim)
Nicely show the size of a file. |
static java.lang.String |
size(long size,
java.lang.String unit)
Nicely show a size, starting from a given measurement unit. |
static java.lang.String |
toInterval(long lInterval)
Convert a time in milliseconds to a human readable interval display |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Format()
| Method Detail |
|---|
public static java.lang.String size(long dim)
dim - file size, in bytes
public static java.lang.String size(long size,
java.lang.String unit)
size - file size, in the specified unitunit - unit. Can be nothing(==B) or one of the following: B, K, M, G, T, P
public static java.lang.String point(double number)
number -
public static java.lang.String extractMailTitle(java.lang.String address)
address - full address
public static java.lang.String extractAddress(java.lang.String address)
address - full address
null if there is no email part in itpublic static java.lang.String escHtml(java.lang.String text)
text - original text
public static java.lang.String encode(java.lang.String text)
text - text to encode
public static java.lang.String decode(java.lang.String text)
text - text to decode
public static java.lang.String escSQL(java.lang.String text)
text - original text
public static java.lang.String escJS(java.lang.String text)
text - original text
public static java.lang.String replace(java.lang.String s,
java.lang.String sWhat,
java.lang.String sWith)
s - original textsWhat - what to search and replacesWith - the new text to put in place
public static final java.lang.String formatBR(java.lang.String text)
text - original text
public static final java.lang.String formatN(java.lang.String text)
formatBR(String), converts HTML line breaks into text line breaks
text - original text
public static final java.util.Date parseDate(java.lang.String s)
s - string to convert
public static final java.lang.String show0(int i)
i - the number to format
public static final java.lang.String showNiceDate(java.util.Date d)
d - date to convert
public static final java.lang.String showDate(java.util.Date d)
d - date to represent
public static final java.lang.String showDottedDate(java.util.Date d)
d - date to show
public static final java.lang.String showLongNamedDate(java.util.Date d)
d - date to show
public static final java.lang.String showNamedDate(java.util.Date d)
d - date to show
public static final java.lang.String showTime(java.util.Date d)
d - date to show
public static final java.lang.String showDottedLong(long l)
l - value to show
public static final java.lang.String showDottedDouble(double d)
d - value to show
public static final java.lang.String showDottedDouble(double d,
int dotplaces)
d - value to showdotplaces - number of decimal places after the point
public static final java.lang.String showDottedDouble(double dbl,
int decimals,
boolean aproximated)
dbl - value to showdecimals - number of decimal places after the pointaproximated - whether or not to use "millions" and "bilions" for very large numbers
public static final java.lang.String toInterval(long lInterval)
lInterval - interval time in milliseconds
public static final char hexChar(int val)
val - value
public static final java.lang.String byteToHex(byte val)
val -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||