Negative number formatting

21 views
Skip to first unread message

Wayne Allen

unread,
Oct 11, 2016, 3:03:47 PM10/11/16
to Fat-Free Framework
I've spent time in the docs and the ICU-formatting site, but I can't seem to find an explanation/example of how to format negative number.

Given something like:
{{ '{0, number, decimal, 2}', @total | format }}

How do I get negative numbers to be in parens? E.g. (12.00) vs -12.00

ved

unread,
Oct 11, 2016, 7:14:07 PM10/11/16
to Fat-Free Framework
You can try using money_format.

{{ money_format('%!(n', @total) }}

ikkez

unread,
Oct 11, 2016, 7:19:17 PM10/11/16
to Fat-Free Framework
what about using a negative value? does this work?

{{ '{0, number, decimal, 2}', @total * -1 | format }}
Reply all
Reply to author
Forward
0 new messages