Singleton
caplin.element.formatter

Fractional8thsFormatter

Formats a decimal to a mixed fraction, rounded to the nearest eighth.

Fractional8thsFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to 1\u215B (one and one eighth, in unicode):

caplin.element.formatter.Fractional8thsFormatter.format(1.126, {})

Constructor Summary

Attributes Name and Description
caplin.element.formatter.Fractional8thsFormatter()

Method Summary

Attributes Name and Description
String format(Variant vValue, Map mAttributes)

Formats a decimal to a mixed fraction, rounded to the nearest eighth.

Constructor Detail

caplin.element.formatter.Fractional8thsFormatter()

Method Detail

String format(Variant vValue, Map mAttributes)

Formats a decimal to a mixed fraction, rounded to the nearest eighth.

Attribute Options:

Option Description
leadingZeroif true, mixed fractions with no integer part are shown with a leading zero (defaults to false).
1the character to use for one eighth (optional, defaults to the unicode character for 1/8).
2the character to use for two eighths (optional, defaults to the unicode character for 1/4).
3the character to use for three eighths (optional, defaults to the unicode character for 3/8).
4the character to use for four eighths (optional, defaults to the unicode character for 1/2).
5the character to use for five eighths (optional, defaults to the unicode character for 5/8).
6the character to use for six eighths (optional, defaults to the unicode character for 3/4).
7the character to use for seven eighths (optional, defaults to the unicode character for 7/8).

Parameters
Variant vValue the decimal number (String or Number type).
Map mAttributes the map of attributes.
Returns
athe mixed fraction, in unicode.