new module:ct-element /formatter /Reg Exp Formatter()
Transforms a string using a standard JavaScript regular expression.
RegExpFormatter
is typically used in the XML Renderer Framework, but can be invoked programmatically
as in the following examples which evaluate to "8987551787.0" and "Buy USD" respectively:
RegExpFormatter.format("8987551787.0", { match:"[A-Z]" })
RegExpFormatter.format("Buy.USD", { match:"(\\.", replace:" " })
- Implements:
Methods
format(vValue, mAttributes) → {String}
Transforms a string using a standard JavaScript regular expression.
By default, only the first match is substituted with the replacement string (unless the "g" option is supplied) and the match is case sensitive (unless the "i" option is supplied).
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vValue |
Variant | the string. |
||||||||||||||||||||
mAttributes |
Map |
the map of attributes. Properties
|
- Implements:
Returns:
the string, converted by the regular expression.
- Type
- String