velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua.L...@reasoning.com
Subject RE: comparing monetary value
Date Thu, 17 Oct 2002 00:39:12 GMT

I admit that I have not read every post on this issue, and
also that formating money is not near and dear to my heart,
however:

Perhapse the way to make everyone happy at once is to have a 
standard java tool for formatting numbers (or maybe formatting 
in general) included in the Velocity distribution.  That way, none of
the formatting syntax needs to pollute the template language
(like it does in FreeMarker).  Also, if someone doesn't need
it, they don't have to use it, or even include it in their
Jar file.  Also, if someone wants a better/different one, they 
can replace it.  On the other hand, the standard one can be
documented and integrated and tested, so it will be easy to
use.

I also think this divides the work properly:
The java programmer worries about data representation issues.
The template writer worries about where and how stuff should be
displayed.

Something like this:
$std.show(267,"0.00") -> 2.67
or maybe the C way:
$std.show(267, "%.2f") -> 2.67
or something higher level:
$std.show(267, "money") -> 2.67

The exact formatting commands matter less than the fact that it
is standardized, documented, tested, etc.

Joshua Levy



--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message