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 291)

WFObject
   |
   --WFFormatter
      |
      --WFNumberFormatter
Class Constant Summary
Variable Summary
Method Summary
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)
WFNumberFormatter __construct ()
Variables
boolean $addOrdinality (line 308)
  • var: TRUE to add cardinality to the end (ie 1st, 2nd, 3rd)
  • access: protected
int $decimalPlaces (line 296)
  • var: The number of decimal places to use.
  • access: protected
string $decimalPoint (line 300)
  • var: The decimal point character.
  • access: protected
string $thousandsSep (line 304)
  • var: The thousands separator character.
  • access: protected
Methods
setCurrencySymbol (line 341)
void setCurrencySymbol ( $s)
  • $s
setDecimalPlaces (line 478)

Set the number of decimal places to use.

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

Set the decimal point to use.

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

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 488)

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

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

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

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.
Constructor __construct (line 318)
WFNumberFormatter __construct ()

Redefinition of:
WFFormatter::__construct()

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::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForUndefinedKey()
WFObject::__toString()
Class Constants
WFNumberFormatterCurrencyStyle = 'Currency' (line 312)
WFNumberFormatterDecimalStyle = 'Decimal' (line 311)
WFNumberFormatterNoStyle = 'None' (line 310)
WFNumberFormatterPercentStyle = 'Percent' (line 313)

Documentation generated on Thu, 07 Aug 2008 10:36:45 -0400 by phpDocumentor 1.4.1