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