Class WFNumberFormatter

Description

The Number format converts between "pretty" numbers with formatting and PHP numeric types.

Default is 2 decimal places, ',' for thousands, and '.' for decimal.

  • todo: Implement full suite of formatting styles, like that of NSNumberFormatter. There are 5 basic styles, None, Decimal, Currency, Percent, and Scientific.
  • todo: Add editingStringForValue capability

Located in /framework/widgets/WFFormatter.php (line 290)

WFObject
   |
   --WFFormatter
      |
      --WFNumberFormatter
Class Constant Summary
Variable Summary
Method Summary
WFNumberFormatter __construct ()
void setCurrencySymbol ( $s)
void setDecimalPlaces (string $dp)
void setDecimalPoint (string $char)
void setStyle (string $style)
void setThousandsSeparator (string $ts)
void stringForValue ( $value)
void valueForString ( $string,  &$error)
Variables
boolean $addOrdinality (line 307)
  • var: TRUE to add cardinality to the end (ie 1st, 2nd, 3rd)
  • access: protected
int $decimalPlaces (line 295)
  • var: The number of decimal places to use.
  • access: protected
string $decimalPoint (line 299)
  • var: The decimal point character.
  • access: protected
string $thousandsSep (line 303)
  • var: The thousands separator character.
  • access: protected
Methods
Constructor __construct (line 317)
WFNumberFormatter __construct ()

Redefinition of:
WFFormatter::__construct()
setCurrencySymbol (line 340)
void setCurrencySymbol ( $s)
  • $s
setDecimalPlaces (line 477)

Set the number of decimal places to use.

void setDecimalPlaces (string $dp)
  • string $dp
setDecimalPoint (line 497)

Set the decimal point to use.

void setDecimalPoint (string $char)
  • string $char
setStyle (line 335)

Set the formatting style. Supported styles are Decimal, Currency, Percent, and Scientific.

NOTE: At this time, only Decimal and Currency are supported.

void setStyle (string $style)
  • string $style: Style to use.
setThousandsSeparator (line 487)

Set the thousands separator to use, or NULL to not use one.

void setThousandsSeparator (string $ts)
  • string $ts
stringForValue (line 345)
void stringForValue ( $value)
  • $value

Redefinition of:
WFFormatter::stringForValue()
Retrieve a string for the passed in value.
valueForString (line 401)

Convert a string (hopefully looking like a number) into a PHP numeric format.

void valueForString ( $string,  &$error)
  • $string
  • &$error

Redefinition of:
WFFormatter::valueForString()
Retreive a value for the passed in string.

Inherited Methods

Inherited From WFFormatter

WFFormatter::__construct()
WFFormatter::editingStringForValue()
WFFormatter::stringForValue()
WFFormatter::valueForString()

Inherited From WFObject

WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::setValuesForKeys()
WFObject::validatedSetValueForKey()
WFObject::validatedSetValueForKeyPath()
WFObject::validateObject()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForStaticKey()
WFObject::valueForStaticKeyPath()
WFObject::valueForTargetAndKeyPath()
WFObject::valueForUndefinedKey()
WFObject::valueForUndefinedStaticKey()
WFObject::valuesForKeyPaths()
WFObject::valuesForKeys()
WFObject::_valueForStaticKey()
WFObject::__toString()
Class Constants
WFNumberFormatterCurrencyStyle = 'Currency' (line 311)
WFNumberFormatterDecimalStyle = 'Decimal' (line 310)
WFNumberFormatterNoStyle = 'None' (line 309)
WFNumberFormatterPercentStyle = 'Percent' (line 312)

Documentation generated on Thu, 14 May 2009 16:20:01 -0400 by phpDocumentor 1.4.2