打印版式

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 : String
    The text to convert
返回:
  • String
    The converted text
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.
参数:
  • value : Mixed
    The value to format
  • format : String
    (可选) Any valid date format string (defaults to 'm/d/Y')
返回:
  • String
    The formatted date string
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
参数:
  • format : String
    Any valid date format string
返回:
  • Function
    The date formatting function
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
参数:
  • value : String
    The string to truncate
  • length : Number
    The maximum length to allow before truncating
返回:
  • String
    The converted text
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 : String
    The string to encode
返回:
  • String
    The encoded text
This method is defined by Format.

lowercase

public function lowercase(String value)
Converts a string to all lower case letters
参数:
  • value : String
    The text to convert
返回:
  • String
    The converted text
This method is defined by Format.

stripTags

public function stripTags(Mixed value)
Strips all HTML tags
参数:
  • value : Mixed
    The text from which to strip tags
返回:
  • String
    The stripped text
This method is defined by Format.

substr

public function substr(String value, Number start, Number length)
Returns a substring from within an original string
参数:
  • value : String
    The original text
  • start : Number
    The start index of the substring
  • length : Number
    The length of the substring
返回:
  • String
    The substring
This method is defined by Format.

trim

public function trim(String value)
Trims any whitespace from either side of a string
参数:
  • value : String
    The text to trim
返回:
  • String
    The trimmed text
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 : Mixed
    Reference to check
返回:
  • Mixed
    Empty string if converted, otherwise the original value
This method is defined by Format.

uppercase

public function uppercase(String value)
Converts a string to all upper case letters
参数:
  • value : String
    The text to convert
返回:
  • String
    The converted text
This method is defined by Format.

usMoney

public function usMoney(Number/String value)
Format a number as US currency
参数:
  • value : Number/String
    The numeric value to format
返回:
  • String
    The formatted currency string
This method is defined by Format.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.