문제

I'm using the g:formatNumber tag to format a number as a currency

<g:formatNumber number="${it.price}" type="currency" currencyCode="${it.currency}"/>

This prints a formatted number such as

GBP6.87

is there some way that I can customise this? In particular, I would like there to be a space between the currency name and the amount, i.e.

GBP 6.87

도움이 되었습니까?

해결책

You can specify your own format string to be whatever you want.

<g:formatNumber number="${myNumber}" format="your format here" />

See http://grails.org/doc/latest/ref/Tags/formatNumber.html and http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top