0

Hi,
I was wondering if it's possible to use the sprintf or any kind of print statements that formats your output into a particular format. The value that is passed to me is "45.0", and I would like the output to be displayed as "45.00".

Thanks for any replies!

3
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by gwong
0

Yes, there are several Java formatters available. Formatter is a generic formatter like printf or sprintf. It can be used with String.format() or also PrintStream's printf() function. NumberFormat, DecimalFormat and DateFormat are also available for formatting string representations.

Edit: Or, yeah, see the template library jwenting posted above if you are wanting JSP tags. :)

0

Yes, there are several Java formatters available. Formatter is a generic formatter like printf or sprintf. It can be used with String.format() or also PrintStream's printf() function. NumberFormat, DecimalFormat and DateFormat are also available for formatting string representations.

Edit: Or, yeah, see the template library jwenting posted above if you are wanting JSP tags. :)

Thanks alot guys! the fmt tag library did the trick.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.