com.sencha.gxt.core.client.util
Class Format

java.lang.Object
  extended by com.sencha.gxt.core.client.util.Format

public class Format
extends java.lang.Object

Formatting functions.


Constructor Summary
Format()
           
 
Method Summary
static java.lang.String camelize(java.lang.String s)
          Camel cases the given string.
static java.lang.String capitalize(java.lang.String value)
          Capitalizes the first character and lower cases the remaining characters.
static java.lang.String currency(double value)
          Provides the standard currency format for the default locale.
static java.lang.String decimal(double value)
          Provides the standard decimal format for the default locale.
static java.lang.String ellipse(java.lang.String value, int len)
          Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length.
static java.lang.String fileSize(int size)
          Returns the file size.
static java.lang.String htmlDecode(java.lang.String value)
          Convert certain characters (&, <, >, and ') from their HTML character equivalents.
static java.lang.String htmlEncode(java.lang.String value)
          Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
static java.lang.String hyphenize(java.lang.String value)
          Replaces camel cases with hyphens.
static java.lang.String number(double value, java.lang.String format)
          Formats the number.
static java.lang.String scientific(double value)
          Provides the standard scientific format for the default locale.
static java.lang.String stripScripts(java.lang.String v)
           
static java.lang.String stripTags(java.lang.String v)
           
static java.lang.String substitute(java.lang.String text, int param)
          Substitutes the indexed parameters.
static java.lang.String substitute(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> params)
          Substitutes the named parameters.
static java.lang.String substitute(java.lang.String text, java.lang.Object... params)
          Substitutes the indexed parameters.
static java.lang.String substitute(java.lang.String text, Params params)
          Substitutes the parameters.
static java.lang.String substitute(java.lang.String text, java.lang.String[] keys, java.util.Map<java.lang.String,java.lang.Object> params)
          Substitutes the named parameters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Format

public Format()
Method Detail

camelize

public static java.lang.String camelize(java.lang.String s)
Camel cases the given string.

Parameters:
s - the string
Returns:
the camel value

capitalize

public static java.lang.String capitalize(java.lang.String value)
Capitalizes the first character and lower cases the remaining characters.

Parameters:
value - the value to capitalize
Returns:
the capitalized value

currency

public static java.lang.String currency(double value)
Provides the standard currency format for the default locale.

Parameters:
value - the value
Returns:
the currency value

decimal

public static java.lang.String decimal(double value)
Provides the standard decimal format for the default locale.

Parameters:
value - the value
Returns:
the value

ellipse

public static java.lang.String ellipse(java.lang.String value,
                                       int len)
Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length.

Parameters:
value - the string to truncate
len - the maximum length to allow before truncating
Returns:
the converted text

fileSize

public static java.lang.String fileSize(int size)
Returns the file size.

Parameters:
size - the size
Returns:
the file size

htmlDecode

public static java.lang.String htmlDecode(java.lang.String value)
Convert certain characters (&, <, >, and ') from their HTML character equivalents.

Parameters:
value - the value
Returns:
the decoded value

htmlEncode

public static java.lang.String htmlEncode(java.lang.String value)
Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages. Delegates to URL.encode(String).

Parameters:
value - the value
Returns:
the encoded value

hyphenize

public static java.lang.String hyphenize(java.lang.String value)
Replaces camel cases with hyphens.

Parameters:
value - the value
Returns:
the hyphenized string

number

public static java.lang.String number(double value,
                                      java.lang.String format)
Formats the number.

Parameters:
value - the number
format - the format using the DateTimeFormat syntax.
Returns:
the formatted string

scientific

public static java.lang.String scientific(double value)
Provides the standard scientific format for the default locale.

Parameters:
value - the value
Returns:
the value

stripScripts

public static java.lang.String stripScripts(java.lang.String v)

stripTags

public static java.lang.String stripTags(java.lang.String v)

substitute

public static java.lang.String substitute(java.lang.String text,
                                          int param)
Substitutes the indexed parameters.

Parameters:
text - the text
param - the parameter
Returns:
the new text

substitute

public static java.lang.String substitute(java.lang.String text,
                                          java.util.Map<java.lang.String,java.lang.Object> params)
Substitutes the named parameters. The passed keys and values must be Strings.

Parameters:
text - the text
params - the parameters
Returns:
the new text

substitute

public static java.lang.String substitute(java.lang.String text,
                                          java.lang.Object... params)
Substitutes the indexed parameters.

Parameters:
text - the text
params - the parameters
Returns:
the new text

substitute

public static java.lang.String substitute(java.lang.String text,
                                          Params params)
Substitutes the parameters.

Parameters:
text - the text
params - the parameters
Returns:
the new text

substitute

public static java.lang.String substitute(java.lang.String text,
                                          java.lang.String[] keys,
                                          java.util.Map<java.lang.String,java.lang.Object> params)
Substitutes the named parameters. The passed keys and values must be Strings.

Parameters:
text - the text
keys - the parameter names
params - the parameter values
Returns:
the new text


Copyright © 2012. All Rights Reserved.