For more information... RTFM!
NAVIGATION
RECENTLY VIEWED
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

commify

Add thousands separators to a given number, and trim to the specified number of decimal places.

Two decimal places will be used unless specified otherwise.

Example

[filter commify.3]1234567890.1234567890[/filter]

Results in:

1,234,567,890.123

Also see the currency filter.

Source code

sub {
    my ($val, $tag, $places) = @_;
    $places = 2 unless defined $places;

    $val = sprintf("%.${places}f", $val) if $places;
    return Vend::Util::commify($val);
}

Category:  Filters
Last modified by: Kevin Walsh
Modification date: Monday 26 February 2007 at 11:37 AM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Contact us