[Templates] formatting a Number with comma seperating 1000's
C. Chad Wallace
cwallace@lodgingcompany.com
Thu, 14 Jun 2007 16:08:50 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Moss wrote:
> Hi,
>
> Was wondering if there is an easy way to format a
> number in template toolkit to pad each 1000 withn a
> comma..
>
> e.g 1000 become 1,000 and 1000000 becomes 1,000,000
Check out the Number::Format plugin:
http://search.cpan.org/dist/Template-Plugin-Number-Format/Format.pm
For example: (untested, since I don't have the plugin installed)
[% USE Number.Format( THOUSANDS_SEP => ',' ) %]
[% "1000" | format_number %]
[% "1000000" | format_number %]
- --
C. Chad Wallace, B.Sc.
The Lodging Company
http://www.skihills.com/
OpenPGP Public Key ID: 0x262208A0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGccqCKeSNHCYiCKARApQZAJ9+e/MAbaG/T4wfx9QfhAFiVzCOIACgvDeP
kTPwsR9MjudEpm0iT2/I6+g=
=8foO
-----END PGP SIGNATURE-----