This does it I believe:
def a = 12345678902345677.45
println String.format( '%,f', a )
That's a core Java method though, not Groovy
Tim
On Tue, Oct 27, 2009 at 2:15 PM, Michael Potter
<michael@...> wrote:
Groovy Crew,
What are my options to format a BigDecimal with commas?
I see code using DecimalFormat( "#,###,###,##0.00" ), but
DecimalFormat requires the BigDecimal be converted to double and I do
not want to take the chance of changing the original number.
I also see BigDecimalLayoutForm(), but I can not find a decent example
to work from and the documentation from Sun is no help.
I figure there is some Groovy one liner that will do this for me so I
asking here.
Thanks,
--
Michael Potter
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email