Caplin Trader 4.8.0

Class: module:caplin/element/formatter/TemplateFormatter

module:caplin/element/formatter/TemplateFormatter

Constructor

new module:caplin/element/formatter/TemplateFormatter()

Formats a value using a template.
Implements:

Methods

format(vValue, mAttributes) → {String}

Formats a value using a template, using the token {0} to represent the field value.

TemplateFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to "30 Year":
TemplateFormatter.format(30, {template: "{0} Year")

Parameters:
Name Type Description
vValue Variant the string.
mAttributes Map the map of attributes.
Properties
Name Type Description
template Map the template to use.
Returns:
the string, formatted using the template.
Type
String