|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gwtext.client.util.Format
public class Format
Reusable data formatting functions.
Constructor Summary | |
---|---|
Format()
|
Method Summary | |
---|---|
static java.lang.String |
date(java.lang.String value)
Parse a value into a formatted date using the specified format pattern. |
static java.lang.String |
date(java.lang.String value,
java.lang.String format)
Parse a value into a formatted date using the specified format pattern. |
static java.lang.String |
ellipsis(java.lang.String value,
int length)
Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length. |
static java.lang.String |
fileSize(double size)
Simple format for a file size (xxx bytes, xxx KB, xxx MB). |
static java.lang.String |
format(java.lang.String format,
int value)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
int value1,
int value2)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
int value1,
int value2,
int value3)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
java.lang.String value)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
java.lang.String[] values)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
java.lang.String value1,
java.lang.String value2)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
java.lang.String value1,
java.lang.String value2,
java.lang.String value3)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
java.lang.String value1,
java.lang.String value2,
java.lang.String value3,
java.lang.String value4)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
java.lang.String value1,
java.lang.String value2,
java.lang.String value3,
java.lang.String value4,
java.lang.String value5)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
java.lang.String value1,
java.lang.String value2,
java.lang.String value3,
java.lang.String value4,
java.lang.String value5,
java.lang.String value6)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
format(java.lang.String format,
java.lang.String value1,
java.lang.String value2,
java.lang.String value3,
java.lang.String value4,
java.lang.String value5,
java.lang.String value6,
java.lang.String value7)
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. |
static java.lang.String |
htmlDecode(java.lang.String value)
Convert certain characters (&, <, >, and ') from their HTML character equivalents. |
static java.lang.String |
htmlEncode(java.lang.String value)
Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages. |
static java.lang.String |
leftPad(java.lang.String string,
int size)
Pads the left side of a string with a specified character. |
static java.lang.String |
leftPad(java.lang.String string,
int size,
java.lang.String character)
Pads the left side of a string with a specified character. |
static java.lang.String |
stripScripts(java.lang.String text)
Strips all script tags. |
static java.lang.String |
stripTags(java.lang.String value)
Strips all HTML tags. |
static java.lang.String |
usMoney(double value)
Format a number as US currency. |
static java.lang.String |
usMoney(java.lang.String value)
Format a number as US currency. |
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 date(java.lang.String value)
value
- the date string
public static java.lang.String date(java.lang.String value, java.lang.String format)
value
- the value to formatformat
- Any valid date format string (defaults to 'm/d/Y')
public static java.lang.String ellipsis(java.lang.String value, int length)
value
- the string to truncatelength
- the maximum length to allow before truncating
public static java.lang.String htmlDecode(java.lang.String value)
value
- the string to decode
public static java.lang.String htmlEncode(java.lang.String value)
value
- the string to encode
public static java.lang.String stripTags(java.lang.String value)
value
- the text from which to strip tags
public static java.lang.String stripScripts(java.lang.String text)
text
- the text from which to strip script tags
public static java.lang.String fileSize(double size)
size
- the numeric value to format
public static java.lang.String usMoney(java.lang.String value)
value
- the value value to format
public static java.lang.String usMoney(double value)
value
- the numeric value to format
public static java.lang.String format(java.lang.String format, int value)
format
- the tokenized string to be formattedvalue
- the value to replace token {0}
public static java.lang.String format(java.lang.String format, java.lang.String value)
format
- the tokenized string to be formattedvalue
- the value to replace token {0}
public static java.lang.String format(java.lang.String format, java.lang.String[] values)
format
- the tokenized string to be formattedvalues
- the value to replace token {0}, {1}, ...
public static java.lang.String format(java.lang.String format, int value1, int value2)
format
- the tokenized string to be formattedvalue1
- the value to replace token {0}value2
- the value to replace token {1}
public static java.lang.String format(java.lang.String format, java.lang.String value1, java.lang.String value2)
format
- the tokenized string to be formattedvalue1
- the value to replace token {0}value2
- the value to replace token {1}
public static java.lang.String format(java.lang.String format, int value1, int value2, int value3)
format
- the tokenized string to be formattedvalue1
- the value to replace token {0}value2
- the value to replace token {1}value3
- the value to replace token {2}
public static java.lang.String format(java.lang.String format, java.lang.String value1, java.lang.String value2, java.lang.String value3)
format
- the tokenized string to be formattedvalue1
- the value to replace token {0}value2
- the value to replace token {1}value3
- the value to replace token {2}
public static java.lang.String format(java.lang.String format, java.lang.String value1, java.lang.String value2, java.lang.String value3, java.lang.String value4)
format
- the tokenized string to be formattedvalue1
- the value to replace token {0}value2
- the value to replace token {1}value3
- the value to replace token {2}value4
- the value to replace token {3}
public static java.lang.String format(java.lang.String format, java.lang.String value1, java.lang.String value2, java.lang.String value3, java.lang.String value4, java.lang.String value5)
format
- the tokenized string to be formattedvalue1
- the value to replace token {0}value2
- the value to replace token {1}value3
- the value to replace token {2}value4
- the value to replace token {3}value5
- the value to replace token {4}
public static java.lang.String format(java.lang.String format, java.lang.String value1, java.lang.String value2, java.lang.String value3, java.lang.String value4, java.lang.String value5, java.lang.String value6)
format
- the tokenized string to be formattedvalue1
- the value to replace token {0}value2
- the value to replace token {1}value3
- the value to replace token {2}value4
- the value to replace token {3}value5
- the value to replace token {4}value6
- the value to replace token {5}
public static java.lang.String format(java.lang.String format, java.lang.String value1, java.lang.String value2, java.lang.String value3, java.lang.String value4, java.lang.String value5, java.lang.String value6, java.lang.String value7)
format
- the tokenized string to be formattedvalue1
- the value to replace token {0}value2
- the value to replace token {1}value3
- the value to replace token {2}value4
- the value to replace token {3}value5
- the value to replace token {4}value6
- the value to replace token {5}value7
- the value to replace token {6}
public static java.lang.String leftPad(java.lang.String string, int size)
String val = Format.leftPad("123", 5, "0"); //val now containts the String "00123"
string
- the original stringsize
- the total length of the output string
public static java.lang.String leftPad(java.lang.String string, int size, java.lang.String character)
String val = Format.leftPad("123", 5, "0"); //val now containts the String "00123"
string
- the original stringsize
- the total length of the output stringcharacter
- he character with which to pad the original string (defaults to empty string " ")
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |