Class Ext.util.Format
| Package: | Ext.util |
| Class: | Format |
| Extends: | Object |
| Defined In: | Format.js |
Reusable data formatting functions
This class is a singleton and cannot be created directly.
Properties
-
Methods
-
Events
Public Properties
This class has no public properties.
Public Methods
| |
capitalize( String value ) : String |
Format |
| Converts the first character only of a string to upper case |
| |
date( Mixed value, [String format] ) : String |
Format |
| Parse a value into a formatted date using the specified format pattern. |
| |
dateRenderer( String format ) : Function |
Format |
| Returns a date rendering function that can be reused to apply a date format multiple times efficiently |
| |
ellipsis( String value, Number length ) : String |
Format |
| Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length |
| |
htmlDecode( String value ) : String |
Format |
| Convert certain characters (&, <, >, and ') from their HTML character equivalents. |
| |
htmlEncode( String value ) : String |
Format |
| Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages. |
| |
lowercase( String value ) : String |
Format |
| Converts a string to all lower case letters |
| |
stripTags( Mixed value ) : String |
Format |
| Strips all HTML tags |
| |
substr( String value, Number start, Number length ) : String |
Format |
| Returns a substring from within an original string |
| |
trim( String value ) : String |
Format |
| Trims any whitespace from either side of a string |
| |
undef( Mixed value ) : Mixed |
Format |
| Checks a reference and converts it to empty string if it is undefined |
| |
uppercase( String value ) : String |
Format |
| Converts a string to all upper case letters |
| |
usMoney( Number/String value ) : String |
Format |
| Format a number as US currency |
Public Events
This class has no public events.
Method Details
capitalize
public function capitalize( String value )
Converts the first character only of a string to upper case
Parameters:
value : StringThe text to convert
Returns:
This method is defined by Format.
date
public function date( Mixed value, [String format] )
Parse a value into a formatted date using the specified format pattern.
This method is defined by Format.
dateRenderer
public function dateRenderer( String format )
Returns a date rendering function that can be reused to apply a date format multiple times efficiently
This method is defined by Format.
ellipsis
public function ellipsis( String value, Number length )
Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length
This method is defined by Format.
htmlDecode
public function htmlDecode( String value )
Convert certain characters (&, <, >, and ') from their HTML character equivalents.
Parameters:
value : StringThe string to decode
Returns:
This method is defined by Format.
htmlEncode
public function htmlEncode( String value )
Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
Parameters:
value : StringThe string to encode
Returns:
This method is defined by Format.
lowercase
public function lowercase( String value )
Converts a string to all lower case letters
Parameters:
value : StringThe text to convert
Returns:
This method is defined by Format.
stripTags
public function stripTags( Mixed value )
This method is defined by Format.
substr
public function substr( String value, Number start, Number length )
Returns a substring from within an original string
This method is defined by Format.
trim
public function trim( String value )
Trims any whitespace from either side of a string
Parameters:
value : StringThe text to trim
Returns:
This method is defined by Format.
undef
public function undef( Mixed value )
Checks a reference and converts it to empty string if it is undefined
Parameters:
value : MixedReference to check
Returns:
This method is defined by Format.
uppercase
public function uppercase( String value )
Converts a string to all upper case letters
Parameters:
value : StringThe text to convert
Returns:
This method is defined by Format.
usMoney
public function usMoney( Number/String value )
Format a number as US currency
This method is defined by Format.