Print Friendly

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

Method Defined By
  capitalizeString value ) : String Format
Converts the first character only of a string to upper case
  dateMixed value, [String format] ) : String Format
Parse a value into a formatted date using the specified format pattern.
  dateRendererString format ) : Function Format
Returns a date rendering function that can be reused to apply a date format multiple times efficiently
  ellipsisString value, Number length ) : String Format
Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length
  htmlDecodeString value ) : String Format
Convert certain characters (&, <, >, and ') from their HTML character equivalents.
  htmlEncodeString value ) : String Format
Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
  lowercaseString value ) : String Format
Converts a string to all lower case letters
  stripTagsMixed value ) : String Format
Strips all HTML tags
  substrString value, Number start, Number length ) : String Format
Returns a substring from within an original string
  trimString value ) : String Format
Trims any whitespace from either side of a string
  undefMixed value ) : Mixed Format
Checks a reference and converts it to empty string if it is undefined
  uppercaseString value ) : String Format
Converts a string to all upper case letters
  usMoneyNumber/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 : String
    The text to convert
Returns:
  • 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.
Parameters:
  • value : Mixed
    The value to format
  • format : String
    (optional) Any valid date format string (defaults to 'm/d/Y')
Returns:
  • 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
Parameters:
  • format : String
    Any valid date format string
Returns:
  • 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
Parameters:
  • value : String
    The string to truncate
  • length : Number
    The maximum length to allow before truncating
Returns:
  • String
    The converted text
This method is defined by Format.

htmlDecode

public function htmlDecode( String value )
Convert certain characters (&, <, >, and ') from their HTML character equivalents.
Parameters:
  • value : String
    The string to decode
Returns:
  • String
    The decoded 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.
Parameters:
  • value : String
    The string to encode
Returns:
  • String
    The encoded text
This method is defined by Format.

lowercase

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

stripTags

public function stripTags( Mixed value )
Strips all HTML tags
Parameters:
  • value : Mixed
    The text from which to strip tags
Returns:
  • 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
Parameters:
  • value : String
    The original text
  • start : Number
    The start index of the substring
  • length : Number
    The length of the substring
Returns:
  • String
    The substring
This method is defined by Format.

trim

public function trim( String value )
Trims any whitespace from either side of a string
Parameters:
  • value : String
    The text to trim
Returns:
  • 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
Parameters:
  • value : Mixed
    Reference to check
Returns:
  • 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
Parameters:
  • value : String
    The text to convert
Returns:
  • String
    The converted text
This method is defined by Format.

usMoney

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

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