Class TNumberFormat
To format numbers in locale sensitive manner use
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. - DefaultText, string,
Gets or sets the default text. If Value is not set, DefaultText will be
shown instead of the default currency Value/Pattern.
| Constants Inherited From TControl |
|
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID,
|
| Method Summary |
|
string
|
|
|
string
|
Get the numberic value for this control.
|
|
string
|
Get the default text value for this control.
|
|
protected
string
|
Formats the localized number, be it currency or decimal, or percentage.
|
|
string
|
Get the number formatting pattern.
|
|
string
|
Get the formatting type for this control.
|
|
string
|
Get the numberic value for this control.
|
|
void
|
|
|
void
|
Set the 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.
|
|
void
|
Set the numberic value for this control.
|
|
void
|
Set the default text value for this control.
|
|
void
|
Set the number format pattern.
|
|
void
|
Set the formatting type for this control.
|
|
void
|
Set the numberic value for this control.
|
| Methods Inherited From TControl |
|
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::convertUniqueIdToClientId(), 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::trackViewState(), TControl::traverseChildControls(), TControl::unbindProperty(), TControl::unloadRecursive(), TControl::unregisterObject(), TControl::__get()
|
| Methods 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()
|
| Method Details |
getCurrency
| public string getCurrency |
() |
| Output |
|
string
| 3 letter currency code. Defaults to 'USD'. |
| Exception |
|
getData
Get the numberic value for this control.
This method is required by IDataRenderer. It is the same as getValue().
| Output |
|
string
| number |
| Exception |
|
getDefaultText
| public string getDefaultText |
() |
Get the default text value for this control.
| Output |
|
string
| default text value |
| Exception |
|
getFormattedValue
| protected string getFormattedValue |
() |
Formats the localized number, be it currency or decimal, or percentage.
If the culture is not specified, the default application culture will be used.
| Output |
|
string
| formatted number |
| Exception |
|
getPattern
| public string getPattern |
() |
Get the number formatting pattern.
| Output |
|
string
| format pattern. |
| Exception |
|
getType
Get the formatting type for this control.
| Output |
|
string
| formatting type. |
| Exception |
|
getValue
| public string getValue |
() |
Get the numberic value for this control.
| Output |
|
string
| number |
| Exception |
|
render
| public void render |
(mixed $writer ) |
| Input |
| mixed | $writer | |
| Output |
| Exception |
|
setCurrency
| public void setCurrency |
(string $currency ) |
Set the 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.
| Input |
| string | $currency | currency code. |
| Output |
| Exception |
|
setData
| public void setData |
(string $value ) |
Set the numberic value for this control.
This method is required by IDataRenderer. It is the same as setValue().
| Input |
| string | $value | the number value |
| Output |
| Exception |
|
setDefaultText
| public void setDefaultText |
(string $value ) |
Set the default text value for this control.
| Input |
| string | $value | default text value |
| Output |
| Exception |
|
setPattern
| public void setPattern |
(string $pattern ) |
Set the number format pattern.
| Input |
| string | $pattern | format pattern. |
| Output |
| Exception |
|
setType
| public void setType |
(string $type ) |
Set the formatting type for this control.
| Input |
| string | $type | formatting type, either "decimal", "currency","percentage" or "scientific" |
| Output |
| Exception |
| throws | TPropertyTypeInvalidException |
|
setValue
| public void setValue |
(string $value ) |
Set the numberic value for this control.
| Input |
| string | $value | the number value |
| Output |
| Exception |
|
|