Caplin Trader 4.8.0

Class: module:caplin/element/parser/BracketsParser

module:caplin/element/parser/BracketsParser

Constructor

new module:caplin/element/parser/BracketsParser()

Parses an amount with brackets and converts it to a negative number.

BracketsParser is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to '-123':

caplin.element.parser.BracketsParser.parse('(123)', {})

See @link module:caplin/element/formatter/BracketsFormatter} for the complementary formatter.
Implements:

Methods

parse(vValue) → {String}

Converts amounts with brackets and converts it to a negative number.
Parameters:
Name Type Description
vValue Variant the amount.
Returns:
the amount, with any brackets removed and converted to a negative number.
Type
String