forked from umakantp/jsmart
-
Notifications
You must be signed in to change notification settings - Fork 2
string_format
pfaciana edited this page Sep 25, 2019
·
1 revision
This is a way to format strings, such as decimal numbers and such. Use the syntax for sprintf() for the formatting.
This modifier uses Javascript port of PHP function sprintf(). You can find one at phpjs.org
| Parameter Position | Type | Required | Default | Description |
|---|---|---|---|---|
| 1 | string | Yes | n/a | This is what format to use. (sprintf) |
Template:
{$articleTitle = 23.5787446}
{$number}
{$number|string_format:"%.2f"}
{$number|string_format:"%d"}output:
23.5787446
23.58
23