## Class TNumberFormat

Description

To format numbers in locale sensitive manner use

     <com:TNumberFormat Pattern="0.##" value="2.0" />

Numbers can be formatted as currency, percentage, decimal or scientific numbers by specifying the Type attribute. The known types are "currency", "percentage", "decimal" and "scientific".

If someone from US want to see sales figures from a store in Germany (say using the EURO currency), formatted using the german currency, you would need to use the attribute Culture="de_DE" to get the currency right, e.g. 100,00 â‚?. The decimal and grouping separator is then also from the de_DE locale. This may lead to some confusion because people from US know the "," as thousand separator. Therefore a "Currency" attribute is available, so that the output from the following example results in â‚?100.00

     <com:TNumberFormat Type="currency" Culture="en_US" Currency="EUR" Value="100" />

Namespace: System.I18N

Properties

- Value, number,
  Gets or sets the number to format. The tag content is used as Value if the Value property is not specified.
- Type, string,
  Gets or sets the formatting type. The valid types are 'decimal', 'currency', 'percentage' and 'scientific'.
- Currency, string,
  Gets or sets the currency symbol for the currency format. The default is 'USD' if the Currency property is not specified.
- Pattern, string,
  Gets or sets the custom number formatting pattern.

- version: v1.0, last update on Sat Dec 11 17:49:56 EST 2004
- author: Xiang Wei Zhuo <weizhuo[at]gmail[dot]com>

Located in /I18N/TNumberFormat.php (line 64)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TI18NControl
                |
                --TNumberFormat

Variable Summary
NumberFormat $formatter
Method Summary
string getCurrency ()
string getFormattedValue ()
string getPattern ()
string getType ()
string getValue ()
void render (mixed $writer)
void setCurrency (string $currency)
void setPattern (string $pattern)
void setType (string $type)
void setValue (string $value)
Variables
NumberFormat $formatter (line 70)

Default NumberFormat, set to the application culture.

- static:
- access: protected

Methods
getCurrency (line 146)

- return: 3 letter currency code. Defaults to 'USD'.
- access: public

string getCurrency ()
getFormattedValue (line 167)

Formats the localized number, be it currency or decimal, or percentage.

If the culture is not specified, the default application culture will be used.

- return: formatted number
- access: protected

string getFormattedValue ()
getPattern (line 76)

Get the number formatting pattern.

- return: format pattern.
- access: public

string getPattern ()
getType (line 112)

Get the formatting type for this control.

- return: formatting type.
- access: public

string getType ()
getValue (line 94)

Get the numberic value for this control.

- return: number
- access: public

string getValue ()
render (line 193)

- access: public

void render (mixed $writer)

Redefinition of:

TControl::render()
  Renders the control.

setCurrency (line 156)

Set the 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.

- access: public

void setCurrency (string $currency)

- string $currency: currency code.

setPattern (line 85)

Set the number format pattern.

- access: public

void setPattern (string $pattern)

- string $pattern: format pattern.

setType (line 123)

Set the formatting type for this control.

- access: public
- throws: TPropertyTypeInvalidException

void setType (string $type)

- string $type: formatting type, either "decimal", "currency","percentage" or "scientific"

setValue (line 103)

Set the numberic value for this control.

- access: public

void setValue (string $value)

- string $value: the number value

#### Inherited Methods

Inherited From TI18NControl

> TI18NControl::getCharset()
> TI18NControl::getCulture()
> TI18NControl::setCharset()
> TI18NControl::setCulture()

Inherited From TControl

> TControl::__construct()
> TControl::addedControl()
> TControl::addParsedObject()
> TControl::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::broadcastEventInternal()
> TControl::bubbleEvent()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::createdOnTemplate()
> TControl::dataBind()
> TControl::dataBindChildren()
> TControl::dataBindProperties()
> TControl::ensureChildControls()
> TControl::findControl()
> TControl::findControlsByID()
> TControl::findControlsByType()
> TControl::focus()
> TControl::getAdapter()
> TControl::getAllowChildControls()
> TControl::getAttribute()
> TControl::getAttributes()
> TControl::getChildControlsCreated()
> TControl::getClientID()
> TControl::getControls()
> TControl::getControlStage()
> TControl::getControlState()
> TControl::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasControls()
> TControl::getID()
> TControl::getNamingContainer()
> TControl::getPage()
> TControl::getParent()
> TControl::getRegisteredObject()
> TControl::getSkinID()
> TControl::getSourceTemplateControl()
> TControl::getTemplateControl()
> TControl::getUniqueID()
> TControl::getViewState()
> TControl::getVisible()
> TControl::hasAttribute()
> TControl::initRecursive()
> TControl::isDescendentOf()
> TControl::isObjectRegistered()
> TControl::loadRecursive()
> TControl::loadState()
> TControl::loadStateRecursive()
> TControl::onDataBinding()
> TControl::onInit()
> TControl::onLoad()
> TControl::onPreRender()
> TControl::onUnload()
> TControl::preRenderRecursive()
> TControl::raiseBubbleEvent()
> TControl::registerObject()
> TControl::removeAttribute()
> TControl::removedControl()
> TControl::render()
> TControl::renderChildren()
> TControl::renderControl()
> TControl::saveState()
> TControl::saveStateRecursive()
> TControl::setAdapter()
> TControl::setAttribute()
> TControl::setChildControlsCreated()
> TControl::setControlStage()
> TControl::setControlState()
> TControl::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> TControl::traverseChildControls()
> TControl::unbindProperty()
> TControl::unloadRecursive()
> TControl::unregisterObject()
> TControl::__get()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants

#### Inherited Constants

Inherited from TControl

Documentation generated on Sun, 04 Jun 2006 18:59:57 -0400 by phpDocumentor 1.3.0RC4