Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

2.6 Formatting Class

Money.h++ makes it easy to output decimal numbers in a very wide variety of numeric formats. In C++, class RWDecimalFormat provides a layered interface to the formatting facilities. This lets you format output quickly and easily without any loss in functionality.

For simple formats, all you have to do is supply a string that visually indicates how the number should look. For example, you can format the number -4.23 as "($4.23)" using the picture string (__$.__).

More complicated formats are handled by manipulating the parameters in a formatting object. You can set leading text, trailing text, digit group separators, currency symbols, plus and minus signs and many other parameters. You can even change the formatting at run time in response to, for example, input from a graphical user interface.

For Java, Money.h++ uses MoneyFormat, which is a derivative of the DecimalFormat class.


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.