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.
属性
-
方法
-
事件
公共属性
此类没有公共属性。
公共方法
|
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 |
|
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 |
公共事件
此类没有公共事件。
方法详情
capitalize
public function capitalize(String value
)
Converts the first character only of a string to upper case
参数:
value
: StringThe text to convert
返回:
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.
htmlEncode
public function htmlEncode(String value
)
Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
参数:
value
: StringThe string to encode
返回:
This method is defined by Format.
lowercase
public function lowercase(String value
)
Converts a string to all lower case letters
参数:
value
: StringThe text to convert
返回:
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
参数:
value
: StringThe text to trim
返回:
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
参数:
value
: MixedReference to check
返回:
This method is defined by Format.
uppercase
public function uppercase(String value
)
Converts a string to all upper case letters
参数:
value
: StringThe text to convert
返回:
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.