## 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::addToPostDataLoader()
> TControl::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::bubbleEvent()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::createChildControls()
> TControl::createControlCollection()
> 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::getCustomData()
> TControl::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasChildInitialized()
> TControl::getHasControls()
> TControl::getHasInitialized()
> TControl::getHasLoaded()
> TControl::getHasLoadedPostData()
> TControl::getHasPreRendered()
> 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::setCustomData()
> 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::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> 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

> TControl::AUTOMATIC_ID_PREFIX
> TControl::CLIENT_ID_SEPARATOR
> TControl::CS_CHILD_INITIALIZED
> TControl::CS_CONSTRUCTED
> TControl::CS_INITIALIZED
> TControl::CS_LOADED
> TControl::CS_PRERENDERED
> TControl::CS_STATE_LOADED
> TControl::ID_FORMAT
> TControl::ID_SEPARATOR
> TControl::IS_CHILD_CREATED
> TControl::IS_CREATING_CHILD
> TControl::IS_DISABLE_THEMING
> TControl::IS_DISABLE_VIEWSTATE
> TControl::IS_ID_SET
> TControl::IS_SKIN_APPLIED
> TControl::IS_STYLESHEET_APPLIED
> TControl::RF_ADAPTER
> TControl::RF_AUTO_BINDINGS
> TControl::RF_CHILD_STATE
> TControl::RF_CONTROLS
> TControl::RF_CONTROLSTATE
> TControl::RF_DATA_BINDINGS
> TControl::RF_EVENTS
> TControl::RF_NAMED_CONTROLS
> TControl::RF_NAMED_CONTROLS_ID
> TControl::RF_NAMED_OBJECTS
> TControl::RF_SKIN_ID

Documentation generated on Sun, 14 Jan 2007 21:43:35 -0500 by phpDocumentor 1.3.0RC4