Package: | Ext.util |
Defined In: | Format.js |
Class: | Format |
Extends: | Object |
Method | Defined By | |
---|---|---|
date( String/Date value , [String format ] )
:
StringParse a value into a formatted date using the specified format pattern. Parse a value into a formatted date using the specified format pattern. Parameters:
| Format | |
ellipsis( String value , Number length , Boolean word )
:
StringTruncate a string and add an ellipsis ('...') to the end if it exceeds the specified length Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length Parameters:
| Format | |
escape( String string )
:
String<static> Escapes the passed string for ' and \ <static> Escapes the passed string for ' and \ Parameters:
| Format | |
escapeRegex( String str )
:
StringEscapes the passed string for use in a regular expression Escapes the passed string for use in a regular expression Parameters:
| Format | |
format( String string , String value1 , String value2 )
:
String<static> Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
token ... <static> 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. Example usage:
Parameters:
| Format | |
htmlDecode( String value )
:
StringConvert certain characters (&, <, >, and ') from their HTML character equivalents. Convert certain characters (&, <, >, and ') from their HTML character equivalents. Parameters:
| Format | |
htmlEncode( String value )
:
StringConvert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages. Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages. Parameters:
| Format | |
leftPad( String string , Number size , [String char ] )
:
String<static> Pads the left side of a string with a specified character. This is especially useful
for normalizing number and date... <static> Pads the left side of a string with a specified character. This is especially useful
for normalizing number and date strings. Example usage:
Parameters:
| Format | |
toggle( String string , String value , String other )
:
StringUtility function that allows you to easily switch a string between two alternating values. The passed value
is compa... Utility function that allows you to easily switch a string between two alternating values. The passed value
is compared to the current string, and if they are equal, the other value that was passed in is returned. If
they are already different, the first value passed in is returned. Note that this method returns the new value
but does not change the current string.
Parameters:
| Format | |
trim( String string )
:
StringTrims whitespace from either end of a string, leaving spaces within the string intact. Example:
var s = ' foo bar ... Trims whitespace from either end of a string, leaving spaces within the string intact. Example:
Parameters:
| Format |